:root {
  color-scheme: light;
  --bg: #17172a;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-2: rgba(244, 247, 255, 0.74);
  --ink: #182039;
  --muted: #77829f;
  --line: rgba(213, 220, 241, 0.72);
  --accent: #70d6ff;
  --accent-strong: #59a7ff;
  --violet: #9b8cff;
  --green: #53e6bb;
  --green-soft: rgba(83, 230, 187, 0.16);
  --red: #ff6b7d;
  --red-soft: rgba(255, 107, 125, 0.15);
  --amber: #ffd166;
  --amber-soft: rgba(255, 209, 102, 0.17);
  --blue-soft: rgba(112, 214, 255, 0.18);
  --glass: rgba(255, 255, 255, 0.12);
  --dark-card: rgba(27, 28, 55, 0.82);
  --shadow: 0 28px 74px rgba(3, 7, 24, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(37, 42, 80, 0.88) 0%, rgba(19, 22, 44, 0.98) 42%, rgba(76, 62, 82, 0.94) 100%),
    linear-gradient(90deg, #a8d9df 0%, #252a46 32%, #1b1d35 70%, #eee7ef 100%);
  background-attachment: fixed;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  fill: currentColor;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 52px);
  color: #fff;
  background: rgba(19, 22, 44, 0.58);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.82rem;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #dff8ff;
  background: linear-gradient(145deg, #16213f, #0c7891);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(112, 214, 255, 0.22);
}

.brand-mark svg {
  width: 23px;
}

.view-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
}

.tab-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  color: rgba(255, 255, 255, 0.62);
  background: transparent;
  border: 0;
  border-radius: 11px;
}

.tab-button svg {
  width: 18px;
  height: 18px;
}

.tab-button.is-active {
  color: #122035;
  background: linear-gradient(135deg, rgba(218, 246, 255, 0.96), rgba(239, 232, 255, 0.96));
  box-shadow: 0 10px 30px rgba(112, 214, 255, 0.18);
}

main {
  padding: clamp(18px, 4vw, 48px);
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.phone-stage {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(280px, 440px);
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 5vw, 62px);
  min-height: calc(100vh - 148px);
}

.phone-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 390px);
  min-height: 800px;
  margin: 0 auto;
  padding: 18px;
  background: linear-gradient(180deg, #11152d 0%, #151a37 58%, #232445 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 34px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.phone-frame::before {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 94px;
  height: 22px;
  content: "";
  background: #17172f;
  border-radius: 0 0 18px 18px;
  transform: translateX(-50%);
}

.phone-frame > *:not(.phone-status) {
  background: transparent;
}

.phone-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.78rem;
}

.status-dots {
  width: 38px;
  height: 12px;
  background:
    linear-gradient(90deg, #fff 0 7px, transparent 7px 10px, #fff 10px 18px, transparent 18px 22px, #fff 22px 38px);
  border-radius: 999px;
  opacity: 0.9;
}

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 18px 14px;
  color: #fff;
  border-radius: 22px 22px 0 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: #95ecff;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

.screen-header h1,
.panel-heading h1,
.panel-heading h2 {
  margin: 0;
  line-height: 1.1;
}

.screen-header h1 {
  font-size: 1.55rem;
}

.avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #dff8ff;
  font-weight: 800;
  background: linear-gradient(145deg, rgba(112, 214, 255, 0.28), rgba(155, 140, 255, 0.24));
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.08), 0 12px 24px rgba(0, 0, 0, 0.18);
}

.field {
  display: grid;
  gap: 7px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.82rem;
  font-weight: 700;
}

.field input,
.field select,
.search-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: #f8fbff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  outline: none;
}

.field input::placeholder,
.search-field input::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

.field select option {
  color: #182039;
}

.field input:focus,
.field select:focus,
.search-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(112, 214, 255, 0.14);
}

.compact-field {
  padding: 0 16px 14px;
}

.membership-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  margin: 4px 16px 0;
  padding: 18px;
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.membership-card p {
  margin: 12px 0 5px;
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.82rem;
  font-weight: 700;
}

.membership-card h2 {
  margin: 0;
  font-size: 1.22rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  color: #eafff8;
  background: rgba(83, 230, 187, 0.18);
  border: 1px solid rgba(83, 230, 187, 0.28);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
}

.status-pill.is-expired {
  color: #ffe8eb;
  background: var(--red-soft);
  border-color: rgba(255, 107, 125, 0.25);
}

.status-pill.is-blocked {
  color: #fff5dc;
  background: var(--amber-soft);
  border-color: rgba(255, 209, 102, 0.28);
}

.status-pill.is-warning {
  color: #fff5dc;
  background: var(--amber-soft);
  border-color: rgba(255, 209, 102, 0.28);
}

.status-pill.is-waiting {
  color: #e5f8ff;
  background: var(--blue-soft);
  border-color: rgba(112, 214, 255, 0.28);
}

.membership-meta {
  display: grid;
  align-content: end;
  gap: 5px;
  text-align: right;
}

.membership-meta span {
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.75rem;
}

.membership-meta strong {
  font-size: 0.88rem;
}

.door-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.door-card {
  position: relative;
  min-height: 250px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(22, 29, 62, 0.2) 0%, rgba(21, 27, 56, 0.78) 44%, rgba(232, 224, 245, 0.22) 100%),
    linear-gradient(135deg, #152a48 0%, #1c2140 48%, #62566b 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 26px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 20px 48px rgba(0, 0, 0, 0.22);
  perspective: 760px;
}

.scene-sky {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 16%, rgba(255, 255, 255, 0.04) 16% 17%, transparent 17% 34%, rgba(255, 255, 255, 0.04) 34% 35%, transparent 35% 100%),
    linear-gradient(0deg, transparent 0 20%, rgba(255, 255, 255, 0.035) 20% 21%, transparent 21% 43%, rgba(255, 255, 255, 0.035) 43% 44%, transparent 44% 100%);
  opacity: 0.72;
}

.door-light {
  position: absolute;
  top: 30px;
  left: 50%;
  width: 150px;
  height: 82px;
  background: linear-gradient(180deg, rgba(159, 240, 255, 0.5), rgba(112, 214, 255, 0));
  filter: blur(10px);
  transform: translateX(-50%);
  opacity: 0.9;
}

.floor-plate {
  position: absolute;
  right: 44px;
  bottom: 32px;
  width: 172px;
  height: 70px;
  background: linear-gradient(135deg, rgba(174, 211, 255, 0.52), rgba(241, 224, 246, 0.52));
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  transform: rotateX(64deg) rotateZ(-8deg);
  box-shadow: 0 20px 36px rgba(7, 16, 36, 0.32);
}

.relay-box {
  position: absolute;
  top: 28px;
  left: 22px;
  width: 88px;
  height: 58px;
  padding: 11px;
  color: #dff8ff;
  background: linear-gradient(145deg, rgba(78, 204, 255, 0.22), rgba(83, 230, 187, 0.12));
  border: 1px solid rgba(112, 214, 255, 0.42);
  border-radius: 16px;
  box-shadow: 0 16px 34px rgba(112, 214, 255, 0.16);
}

.relay-box span {
  display: block;
  font-size: 0.72rem;
  font-weight: 900;
}

.relay-box i {
  display: block;
  width: 16px;
  height: 16px;
  margin-top: 10px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 7px rgba(83, 230, 187, 0.12), 0 0 18px rgba(83, 230, 187, 0.78);
}

.wire {
  position: absolute;
  left: 102px;
  width: 106px;
  height: 2px;
  background: rgba(255, 209, 102, 0.8);
  transform-origin: left center;
}

.wire-a {
  top: 48px;
  transform: rotate(13deg);
}

.wire-b {
  top: 65px;
  background: rgba(112, 214, 255, 0.78);
  transform: rotate(5deg);
}

.door-visual {
  position: absolute;
  right: 72px;
  bottom: 58px;
  width: 118px;
  height: 154px;
  background: linear-gradient(145deg, #e7f7ff, #8fb2df);
  border: 0;
  border-radius: 18px 18px 7px 7px;
  box-shadow: 0 28px 42px rgba(4, 8, 24, 0.36), inset 0 0 0 5px rgba(18, 34, 62, 0.74);
  perspective: 620px;
}

.door-leaf {
  position: absolute;
  inset: 14px 14px 0;
  background: linear-gradient(145deg, #1d3d6b, #58a5f4 58%, #b7efff);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 12px 12px 4px 4px;
  transform-origin: left center;
  transition: transform 680ms cubic-bezier(0.2, 0.82, 0.2, 1), box-shadow 680ms ease, filter 680ms ease;
  transform-style: preserve-3d;
}

.door-panel.is-open .door-leaf {
  filter: brightness(1.12);
  transform: rotateY(-62deg) translateZ(4px);
  box-shadow: 28px 0 46px rgba(112, 214, 255, 0.24), inset 12px 0 18px rgba(255, 255, 255, 0.12);
}

.door-panel.is-open .door-light {
  opacity: 1;
  filter: blur(7px);
}

.door-frame-top {
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 14px;
  background: linear-gradient(90deg, #dff8ff, #80d9ff);
  border-radius: 12px 12px 3px 3px;
}

.door-window {
  position: absolute;
  top: 26px;
  left: 24px;
  width: 28px;
  height: 30px;
  background: linear-gradient(145deg, #fff0a8, #8ff2ff);
  border-radius: 7px 7px 3px 3px;
  box-shadow: 0 0 18px rgba(255, 240, 168, 0.6);
}

.door-handle {
  position: absolute;
  top: 76px;
  right: 12px;
  width: 11px;
  height: 11px;
  background: #fff0a8;
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(255, 240, 168, 0.62);
}

.lock-strike {
  position: absolute;
  top: 75px;
  left: -8px;
  width: 8px;
  height: 22px;
  background: #fff0a8;
  border-radius: 999px;
}

.access-reader {
  position: absolute;
  right: 40px;
  bottom: 102px;
  display: grid;
  width: 38px;
  height: 54px;
  place-items: center;
  background: linear-gradient(180deg, rgba(226, 240, 255, 0.9), rgba(118, 155, 205, 0.86));
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 16px;
  box-shadow: 0 18px 32px rgba(4, 8, 24, 0.3);
}

.access-reader span {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: rgba(20, 31, 58, 0.7);
  box-shadow: inset 0 0 0 4px rgba(112, 214, 255, 0.22);
}

.access-reader i {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(83, 230, 187, 0.8);
}

.door-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #fff;
}

.door-copy p {
  margin: 0;
  font-weight: 900;
}

.door-copy span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.82rem;
  text-align: right;
}

.primary-action,
.secondary-action,
.row-action,
.icon-action {
  border: 0;
  border-radius: 16px;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  font-weight: 900;
}

.primary-action {
  margin: 0 16px;
  position: relative;
  overflow: hidden;
  color: #0d1d33;
  background: linear-gradient(135deg, #8ff2ff 0%, #b9a7ff 58%, #fff0d1 100%);
  box-shadow: 0 18px 38px rgba(112, 214, 255, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.58);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.primary-action::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.32), transparent);
  transform: translateX(-120%);
  transition: transform 420ms ease;
}

.primary-action:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow: 0 22px 42px rgba(112, 214, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.primary-action:hover::after {
  transform: translateX(120%);
}

.primary-action:disabled {
  cursor: not-allowed;
  color: rgba(255, 255, 255, 0.74);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
  transform: none;
}

.primary-action svg,
.secondary-action svg,
.row-action svg,
.icon-action svg,
.search-field svg {
  width: 19px;
  height: 19px;
}

.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  margin-left: 16px;
  margin-right: 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 18px;
}

.mini-grid div {
  display: grid;
  gap: 6px;
  padding: 15px 16px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.mini-grid span,
.stats-row span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.76rem;
  font-weight: 700;
}

.mini-grid strong {
  font-size: 1rem;
}

.operations-panel,
.admin-sidebar,
.admin-main {
  color: #fff;
  background: rgba(19, 22, 44, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 24px;
  box-shadow: 0 24px 64px rgba(3, 7, 24, 0.28);
  backdrop-filter: blur(18px);
}

.operations-panel {
  display: grid;
  gap: 22px;
  padding: 24px;
}

.panel-heading h2,
.panel-heading h1 {
  font-size: 1.55rem;
}

.signal-board {
  display: grid;
  gap: 10px;
}

.signal-board div {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
}

.signal-board span:not(.signal-dot) {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.86rem;
  font-weight: 700;
}

.signal-board strong {
  font-size: 0.88rem;
}

.signal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.is-green {
  background: var(--green);
}

.is-amber {
  background: var(--amber);
}

.is-blue {
  background: var(--accent);
}

.event-feed,
.access-log {
  display: grid;
  gap: 10px;
}

.event-item,
.log-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
}

.event-icon,
.log-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #dffff7;
  background: var(--green-soft);
  border-radius: 13px;
}

.event-icon.is-denied,
.log-icon.is-denied {
  color: #ffe6ea;
  background: var(--red-soft);
}

.event-icon svg,
.log-icon svg {
  width: 18px;
  height: 18px;
}

.event-item strong,
.log-item strong {
  display: block;
  font-size: 0.9rem;
}

.event-item span,
.log-item span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.78rem;
}

.event-time,
.log-time {
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.76rem;
  font-weight: 800;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
}

.admin-sidebar {
  align-self: start;
  padding: 22px;
}

.admin-form {
  display: grid;
  gap: 15px;
  margin-top: 22px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.secondary-action {
  color: #0d1d33;
  background: linear-gradient(135deg, #e6fbff, #c8bcff);
  box-shadow: 0 16px 34px rgba(112, 214, 255, 0.18);
}

.secondary-action:hover {
  filter: brightness(1.04);
}

.admin-main {
  padding: 22px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
}

.stats-row article {
  display: grid;
  gap: 8px;
  padding: 16px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
}

.stats-row strong {
  font-size: 1.75rem;
}

.member-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 14px;
}

.search-field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 13px;
  color: rgba(255, 255, 255, 0.58);
  transform: translateY(-50%);
}

.search-field input {
  padding-left: 42px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.icon-action {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #e7f9ff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.members-table {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
}

.table-head,
.member-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) minmax(150px, 1fr) minmax(120px, 0.8fr) minmax(240px, 1.35fr);
  align-items: center;
  gap: 12px;
}

.table-head {
  min-height: 42px;
  padding: 0 14px;
  color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.member-row {
  min-height: 78px;
  padding: 13px 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.055);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.client-cell {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.client-cell .avatar {
  width: 38px;
  height: 38px;
  font-size: 0.8rem;
}

.client-cell strong,
.client-cell span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-cell span,
.plan-cell span {
  display: block;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.8rem;
}

.plan-cell strong {
  display: block;
  margin-bottom: 3px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 10px;
  color: #e9f9ff;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
  font-weight: 800;
}

.row-action.is-danger {
  color: #ffe6ea;
  background: var(--red-soft);
}

.row-action.is-good {
  color: #dffff7;
  background: var(--green-soft);
}

.log-section {
  margin-top: 24px;
}

.access-log {
  max-height: 320px;
  margin-top: 14px;
  overflow: auto;
  padding-right: 4px;
}

.empty-state {
  padding: 24px;
  color: rgba(255, 255, 255, 0.58);
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
}

.is-hidden {
  display: none !important;
}

.auth-panel,
.client-app {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px;
  color: #fff;
}

.auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
}

.auth-top h1 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.08;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
}

.auth-mode {
  min-height: 40px;
  color: rgba(255, 255, 255, 0.58);
  font-weight: 900;
  background: transparent;
  border: 0;
  border-radius: 13px;
}

.auth-mode.is-active {
  color: #0d1d33;
  background: linear-gradient(135deg, #e5fbff, #ded7ff);
  box-shadow: 0 10px 30px rgba(112, 214, 255, 0.16);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-submit {
  width: 100%;
  margin: 6px 0 0;
}

.ghost-action {
  min-height: 44px;
  color: #dff8ff;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
}

.auth-message {
  min-height: 22px;
  margin: 0;
  color: var(--red);
  font-size: 0.84rem;
  font-weight: 800;
}

.client-app {
  display: flex;
  flex-direction: column;
}

.avatar-button {
  border: 0;
}

.avatar-button span {
  pointer-events: none;
}

.client-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  padding: 0 16px 14px;
  background: transparent;
}

.client-nav-button {
  display: grid;
  min-height: 54px;
  place-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  font-size: 0.75rem;
  font-weight: 900;
}

.client-nav-button svg {
  width: 18px;
  height: 18px;
}

.client-nav-button.is-active {
  color: #e8fbff;
  background: rgba(112, 214, 255, 0.16);
  border-color: rgba(112, 214, 255, 0.34);
  box-shadow: 0 12px 24px rgba(112, 214, 255, 0.12);
}

.client-pages {
  min-height: 0;
  overflow: auto;
  background: transparent;
}

.client-page {
  display: none;
}

.client-page.is-active {
  display: block;
}

.access-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 16px 14px;
}

.access-steps span {
  display: grid;
  min-height: 34px;
  place-items: center;
  color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
}

.access-steps span.is-ok {
  color: #0b6b48;
  background: var(--green-soft);
  border-color: rgba(15, 159, 110, 0.32);
}

.access-steps span.is-denied {
  color: #9a2424;
  background: var(--red-soft);
  border-color: rgba(216, 58, 58, 0.28);
}

.access-steps span.is-muted {
  color: var(--muted);
  background: #eef3f9;
}

.client-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 12px;
  color: #fff;
}

.client-section-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.client-section-head span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.82rem;
  font-weight: 800;
}

.client-history {
  display: grid;
  gap: 10px;
  padding: 0 16px 18px;
}

.profile-grid {
  display: grid;
  gap: 10px;
  padding: 18px 16px;
}

.profile-grid div {
  display: grid;
  gap: 6px;
  padding: 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
}

.profile-grid span {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.78rem;
  font-weight: 800;
}

.profile-grid strong {
  overflow-wrap: anywhere;
}

.subscription-editor {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.subscription-editor .panel-heading h2 {
  font-size: 1.15rem;
}

.editor-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.toggle-field {
  align-content: end;
}

.toggle-field input {
  width: 52px;
  min-height: 30px;
  accent-color: var(--accent);
}

.editor-actions .secondary-action {
  min-height: 44px;
}

.member-row.is-selected {
  background: rgba(112, 214, 255, 0.12);
  box-shadow: inset 4px 0 0 var(--accent);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(320px, calc(100vw - 44px));
  padding: 13px 16px;
  color: #fff;
  font-weight: 900;
  background: #16263b;
  border-radius: 8px;
  box-shadow: 0 18px 38px rgba(33, 53, 82, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .phone-stage,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .phone-stage {
    min-height: auto;
  }

  .operations-panel {
    max-width: 390px;
    margin: 0 auto;
  }

  .admin-sidebar {
    order: 2;
  }

  .admin-main {
    order: 1;
  }

  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: 88px;
  }

  .topbar {
    position: fixed;
    top: auto;
    right: 14px;
    bottom: 14px;
    left: 14px;
    align-items: center;
    flex-direction: row;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 24px;
    box-shadow: 0 20px 48px rgba(3, 7, 24, 0.34);
  }

  .brand {
    display: none;
  }

  .view-switch {
    width: 100%;
    background: transparent;
    border: 0;
  }

  .tab-button {
    flex: 1;
    justify-content: center;
  }

  main {
    padding: 16px 12px 8px;
  }

  .phone-frame {
    width: 100%;
    min-height: calc(100vh - 118px);
    border-radius: 30px;
  }

  .membership-card {
    grid-template-columns: 1fr;
  }

  .membership-meta {
    text-align: left;
  }

  .door-copy {
    align-items: flex-start;
    flex-direction: column;
  }

  .door-copy span {
    text-align: left;
  }

  .stats-row,
  .form-row {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    gap: 14px;
  }

  .admin-sidebar,
  .admin-main,
  .operations-panel {
    border-radius: 22px;
  }

  .admin-sidebar,
  .admin-main {
    padding: 16px;
  }

  .stats-row {
    display: flex;
    gap: 10px;
    margin: 0 -16px;
    overflow-x: auto;
    padding: 0 16px 4px;
    scroll-snap-type: x mandatory;
  }

  .stats-row article {
    min-width: 138px;
    scroll-snap-align: start;
  }

  .stats-row strong {
    font-size: 1.55rem;
  }

  .member-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .table-head {
    display: none;
  }

  .member-row {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
    min-height: auto;
    margin: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
  }

  .members-table {
    overflow: visible;
    border: 0;
  }

  .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .row-action {
    justify-content: center;
    min-height: 42px;
    padding: 0 8px;
  }

  .editor-actions {
    grid-template-columns: 1fr;
  }

  .access-log {
    max-height: none;
  }
}

@media (max-width: 420px) {
  .phone-frame {
    padding: 12px;
  }

  .screen-header,
  .compact-field,
  .membership-card,
  .door-panel {
    padding-left: 12px;
    padding-right: 12px;
  }

  .primary-action {
    margin-left: 12px;
    margin-right: 12px;
  }

  .door-card {
    min-height: 230px;
  }

  .door-visual {
    right: 58px;
    width: 108px;
    height: 146px;
  }

  .access-reader {
    right: 28px;
  }

  .relay-box {
    left: 16px;
  }
}
