:root {
  color-scheme: light;
  --app-bg-top: #8e9eab;
  --app-bg-bottom: #eef2f3;
  --app-ink: #0d1720;
  --app-dark: #152331;
  --app-black: #000;
  --app-accent: #d9f27c;
  --app-success: #0f6b4f;
  --app-warning: #9a6700;
  --bs-body-font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bs-body-color: var(--app-ink);
  --bs-dark: var(--app-dark);
  --bs-dark-rgb: 21, 35, 49;
  --bs-border-radius: 0.5rem;
  --bs-border-radius-sm: 0.4rem;
  --bs-border-color: rgba(21, 35, 49, 0.12);
}

* { box-sizing: border-box; }

html {
  min-width: 0;
  background: var(--app-dark);
}

body {
  min-width: 0;
  min-height: 100svh;
  overflow-x: clip;
  background: linear-gradient(180deg, var(--app-bg-top), var(--app-bg-bottom));
}

.home-page,
.admin-page,
.flow-page { padding-bottom: 78px; }

.login-page { padding-bottom: 0; }

.home-hero,
.admin-hero,
.login-hero {
  background: linear-gradient(135deg, var(--app-dark), var(--app-black));
}

.home-hero,
.admin-hero {
  min-height: 210px;
  border-radius: 0 0 2rem 2rem;
  animation: hero-in 480ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.home-page .home-hero {
  animation: signed-in-hero-up 620ms cubic-bezier(0.2, 0.82, 0.2, 1) both;
}

.login-hero {
  min-height: 90svh;
  border-radius: 0 0 2.5rem 2.5rem;
}

.hero-title {
  color: #fff;
  font-size: clamp(1.45rem, 4vw, 2rem);
  font-weight: 300;
}

.home-hi {
  color: #fff;
  font-size: clamp(3.2rem, 14vw, 5.5rem);
  font-weight: 750;
  line-height: 0.95;
}

.hero-name {
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1.35rem, 5vw, 2rem);
  font-weight: 300;
}

.login-title {
  margin-bottom: 0.75rem;
  color: #fff;
  font-size: clamp(3.2rem, 18vw, 6rem);
  font-weight: 750;
  line-height: 0.95;
}

.login-fingerprint {
  min-width: 78px;
  min-height: 78px;
  padding: 0;
  border: 0;
  color: #fff;
  font-size: 3.2rem;
}

.login-fingerprint:hover,
.login-fingerprint:focus-visible,
.login-fingerprint:active {
  border: 0;
  color: #fff;
  transform: translateY(-2px) scale(1.04);
}

.user-avatar,
.object-icon,
.rule-icon {
  display: inline-grid;
  place-items: center;
}

.user-avatar {
  width: 54px;
  height: 54px;
  border: 1.5px solid var(--app-accent);
  border-radius: 50%;
  color: var(--app-accent);
  font-size: 1.4rem;
}

.object-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(217, 242, 124, 0.22);
  color: var(--app-dark);
  font-size: 1.15rem;
}

.rule-icon {
  width: 38px;
  height: 38px;
  border-radius: 0.5rem;
  background: rgba(217, 242, 124, 0.12);
  color: var(--app-accent);
}

.rule-icon.blocked,
.access-toggle.blocked { color: #ffb4b4; }

.access-toggle {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 400;
}

.access-toggle.ok { color: var(--app-accent); }
.text-accent { color: var(--app-accent); }

.stat-block {
  min-width: 92px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--bs-border-radius);
  background: rgba(255, 255, 255, 0.08);
}

.card,
.accordion-item {
  border-color: rgba(21, 35, 49, 0.1);
  border-radius: var(--bs-border-radius);
  background: rgba(255, 255, 255, 0.94);
}

.card { overflow: hidden; }
.flow-card { border-top: 4px solid var(--app-dark); }
.accordion-item { overflow: hidden; }

.card-action-group > .btn {
  border-radius: var(--bs-border-radius-sm) !important;
}

.admin-page .accordion-item,
.admin-entity-card { overflow: visible; }

.sticky-panel-header {
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  border-radius: var(--bs-border-radius);
  background: #fff;
  box-shadow: 0 5px 14px rgba(21, 35, 49, 0.12);
}

.sticky-entity-header {
  top: calc(env(safe-area-inset-top, 0px) + 58px);
  z-index: 10;
  border-color: rgba(21, 35, 49, 0.1);
  box-shadow: 0 4px 12px rgba(21, 35, 49, 0.08);
}

.user-header-icon {
  width: 34px;
  height: 34px;
  font-size: 0.95rem;
}

.accordion-button {
  gap: 0.15rem;
  color: var(--app-ink);
  font-weight: 650;
}

.accordion-button:not(.collapsed) {
  background: rgba(217, 242, 124, 0.12);
  color: var(--app-ink);
  box-shadow: inset 0 -1px 0 rgba(21, 35, 49, 0.08);
}

.accordion-button:focus { box-shadow: 0 0 0 0.2rem rgba(217, 242, 124, 0.42); }

.accordion-flush > .accordion-item {
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  background: transparent;
}

.accordion-flush .accordion-button { background: transparent; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  font-weight: 600;
}

.btn-dark {
  --bs-btn-bg: var(--app-dark);
  --bs-btn-border-color: var(--app-dark);
  --bs-btn-hover-bg: #0d1823;
  --bs-btn-hover-border-color: #0d1823;
}

.text-danger-emphasis { color: #ffc1bd !important; }

.form-control,
.form-select {
  min-height: 40px;
  border-color: #aebdc4;
  background-color: #f4f7f8;
  color: var(--app-dark);
  font-size: 0.92rem;
  text-align: left;
  text-align-last: left;
}

.form-control:focus,
.form-select:focus {
  border-color: #7f929f;
  background-color: #fff;
  box-shadow: 0 0 0 0.2rem rgba(217, 242, 124, 0.42);
}

input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control {
  min-inline-size: 0;
  max-inline-size: 100%;
  overflow: hidden;
}

.form-check-input:checked {
  border-color: #82972d;
  background-color: #82972d;
}

.form-check-input:focus {
  border-color: #82972d;
  box-shadow: 0 0 0 0.2rem rgba(217, 242, 124, 0.42);
}

.device-status { font-weight: 700; }
.device-status.is-closed { color: var(--app-success); }
.device-status.is-open { color: var(--app-warning); }

.current-session-badge,
.live-badge {
  background: rgba(217, 242, 124, 0.18);
  color: var(--app-accent);
}

.current-session-badge { background: var(--app-dark); }
.min-w-0 { min-width: 0; }

.bottom-nav {
  z-index: 1050;
  pointer-events: none;
}

.bottom-nav > .container-fluid > div {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--bs-border-radius);
  background: rgba(28, 32, 33, 0.76);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  backdrop-filter: blur(18px) saturate(1.25);
  pointer-events: auto;
  animation: nav-in 520ms cubic-bezier(0.2, 0.8, 0.2, 1) 90ms both;
}

.nav-control {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: #dbe3df;
}

.nav-control:hover,
.nav-control:focus-visible {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.location-indicator.ok {
  border-color: rgba(217, 242, 124, 0.42);
  background: rgba(217, 242, 124, 0.16);
  color: var(--app-accent);
}

.location-indicator.blocked {
  border-color: rgba(255, 180, 180, 0.2);
  background: rgba(255, 96, 96, 0.12);
  color: #ffb4b4;
}

.location-indicator.pending { opacity: 0.72; }

.toast-status {
  position: fixed;
  z-index: 1100;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
  display: flex;
  align-items: center;
  width: max-content;
  max-width: min(420px, calc(100% - 32px));
  min-height: 48px;
  margin: 0;
  padding: 0.7rem 0.95rem;
  gap: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--bs-border-radius);
  background: rgba(21, 35, 49, 0.94);
  color: #fff;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 220ms ease, transform 280ms ease, visibility 220ms ease;
}

.toast-status.visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.toast-status i { color: var(--app-accent); font-size: 1.25rem; }
.toast-status.error i { color: #ff9f9f; }

@keyframes hero-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes signed-in-hero-up {
  from { opacity: 0; transform: translateY(42svh); }
  to { opacity: 1; transform: translateY(0); }
}

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

@media (max-width: 767.98px) {
  .home-hero,
  .admin-hero { border-radius: 0 0 1.5rem 1.5rem; }

  .form-control,
  .form-select { font-size: 16px; }
}

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