html {
  color-scheme: dark;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(14, 165, 233, 0.18), transparent 28%),
    linear-gradient(180deg, #020617 0%, #0f172a 48%, #020617 100%);
  color: #e2e8f0;
}

::selection {
  background: rgba(14, 165, 233, 0.35);
}

input,
textarea,
select,
button {
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

video {
  width: 100%;
}

/* Keyboard focus stays visible even where the default outline is removed. */
:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.85);
  outline-offset: 2px;
  border-radius: 0.375rem;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline-offset: 0;
}

details > summary {
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

details[open] > summary [data-details-chevron] {
  transform: rotate(180deg);
}

[data-details-chevron] {
  transition: transform 0.18s ease;
}

/* Toast notifications */
.toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 90;
  display: grid;
  gap: 0.6rem;
  width: min(24rem, calc(100vw - 2rem));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  border-radius: 1rem;
  border: 1px solid;
  padding: 0.8rem 1rem;
  font-size: 0.875rem;
  line-height: 1.35;
  box-shadow: 0 18px 45px rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(8px);
  animation: toast-in 0.22s ease-out;
}

.toast--success {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(6, 78, 59, 0.9);
  color: #d1fae5;
}

.toast--error {
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(76, 5, 25, 0.92);
  color: #ffe4e6;
}

.toast--info {
  border-color: rgba(14, 165, 233, 0.4);
  background: rgba(12, 74, 110, 0.9);
  color: #e0f2fe;
}

.toast__close {
  margin-left: auto;
  flex-shrink: 0;
  border-radius: 0.5rem;
  padding: 0.15rem;
  color: inherit;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.toast__close:hover {
  opacity: 1;
}

.toast--leaving {
  animation: toast-out 0.18s ease-in forwards;
}

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

@keyframes toast-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* Native <dialog> styling */
dialog.app-dialog {
  margin: auto;
  width: min(44rem, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 1.5rem;
  background: #0f172a;
  color: #e2e8f0;
  padding: 0;
  box-shadow: 0 40px 120px rgba(2, 6, 23, 0.8);
}

dialog.app-dialog--narrow {
  width: min(30rem, calc(100vw - 2rem));
}

dialog.app-dialog--wide {
  width: min(58rem, calc(100vw - 2rem));
}

dialog.app-dialog::backdrop {
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(3px);
}

dialog.app-dialog[open] {
  animation: dialog-in 0.18s ease-out;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Occupancy meter bars */
.meter {
  height: 0.45rem;
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
}

.meter__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #34d399;
  transition: width 0.3s ease;
}

.meter__fill--mid {
  background: #fbbf24;
}

.meter__fill--high {
  background: #fb7185;
}

@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast--leaving,
  dialog.app-dialog[open] {
    animation: none;
  }

  [data-details-chevron] {
    transition: none;
  }
}
