html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background: #f5f7fa;
  color: #17202a;
}

.admin-container {
  max-width: 1440px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.page-head h1 {
  font-size: 1.85rem;
  line-height: 1.2;
  margin: 0;
}

.metric-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card,
.panel,
.admin-table {
  background: #ffffff;
  border: 1px solid #dde4ee;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.06);
}

.metric-card {
  padding: 1rem;
}

.metric-card span {
  color: #617083;
  display: block;
  font-size: 0.85rem;
}

.metric-card strong {
  display: block;
  font-size: 1.4rem;
  margin-top: 0.25rem;
}

.admin-table {
  padding: 0.25rem;
}

.admin-table table {
  margin-bottom: 0;
}

.status-pill {
  border-radius: 999px;
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 700;
  min-width: 96px;
  padding: 0.35rem 0.65rem;
  text-align: center;
}

.status-available {
  background: #dff4e8;
  color: #126235;
}

.status-degraded {
  background: #fff4cf;
  color: #7a5a00;
}

.status-partial {
  background: #ffe5d0;
  color: #8a3f00;
}

.status-full {
  background: #ffe0df;
  color: #9d1d1d;
}

.status-planned {
  background: #dcecff;
  color: #135ca8;
}

.status-outside {
  background: #eef1f5;
  color: #56616f;
}

.status-unknown {
  background: #e2e6ea;
  color: #3e4752;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.admin-tabs a {
  background: #ffffff;
  border: 1px solid #d6dee9;
  border-radius: 8px;
  color: #1f3f68;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
}

.dashboard-columns {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 1rem;
}

.panel h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.list-row {
  align-items: center;
  border-top: 1px solid #edf1f5;
  display: flex;
  justify-content: space-between;
  min-height: 44px;
  gap: 1rem;
}

.admin-form {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-form-grid {
  align-items: end;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-form-grid--wide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-json {
  min-height: 84px;
}

.record-stack {
  display: grid;
  gap: 1rem;
}

.record-card {
  display: grid;
  gap: 0.75rem;
}

.record-actions {
  display: flex;
  gap: 0.5rem;
}

.record-delete {
  display: flex;
  justify-content: flex-end;
}

.sneat-table-card {
  background: #ffffff;
  border: 1px solid #e6e9ef;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(67, 89, 113, 0.08);
  overflow: hidden;
}

.sneat-table-toolbar {
  align-items: center;
  border-bottom: 1px solid #edf0f5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  padding: 1rem 1.25rem;
}

.sneat-table-toolbar h2 {
  color: #566a7f;
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.sneat-table {
  color: #566a7f;
  margin-bottom: 0;
}

.sneat-table thead th {
  background: #f5f5f9;
  border-bottom: 1px solid #e7e7ef;
  color: #697a8d;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.sneat-table tbody td {
  border-color: #edf0f5;
  vertical-align: middle;
}

.sneat-entity {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  min-width: 220px;
}

.sneat-avatar {
  align-items: center;
  background: #e7e7ff;
  border-radius: 6px;
  color: #696cff;
  display: inline-flex;
  flex: 0 0 38px;
  font-size: 0.85rem;
  font-weight: 700;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.sneat-entity strong {
  color: #384551;
  display: block;
  font-size: 0.9rem;
}

.sneat-entity span {
  color: #8592a3;
  display: block;
  font-size: 0.8rem;
}

.sneat-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  justify-content: flex-end;
  min-width: 170px;
}

.sneat-modal .modal-content {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 0.5rem 1.5rem rgba(67, 89, 113, 0.24);
}

.sneat-modal .modal-header {
  border-bottom: 1px solid #edf0f5;
  padding: 1.15rem 1.25rem;
}

.sneat-modal .modal-title {
  color: #566a7f;
  font-size: 1.05rem;
  font-weight: 700;
}

.sneat-modal .modal-body {
  padding: 1.25rem;
}

.sneat-modal .modal-footer {
  border-top: 1px solid #edf0f5;
}

.sneat-form-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sneat-form-grid .span-2 {
  grid-column: span 2;
}

.sneat-filter {
  min-width: 260px;
}

.admin-form-wide,
.admin-form-actions {
  grid-column: span 2;
}

.stable-select {
  min-width: 112px;
}

.system-filter {
  min-width: 260px;
}

.report-filter {
  align-items: end;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(220px, 1.5fr) repeat(2, minmax(160px, 1fr)) auto;
  padding: 1rem;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pager-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.trend-bars {
  display: grid;
  gap: 0.7rem;
}

.trend-row {
  align-items: center;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 90px 1fr 80px;
}

.trend-track {
  background: #e9eef5;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}

.trend-bar {
  background: #2f8f5b;
  height: 100%;
}

body.login-body {
  background: #0b1018;
  color: #eef4ff;
  margin-bottom: 0;
}

.auth-layout {
  min-height: 100vh;
  overflow: hidden;
}

.auth-main {
  min-height: 100vh;
}

.auth-shell {
  align-content: center;
  align-items: stretch;
  background:
    linear-gradient(90deg, rgba(5, 7, 12, 0.76) 0%, rgba(10, 16, 25, 0.48) 48%, rgba(5, 7, 12, 0.66) 100%),
    url("../images/dovitec-login-background.svg") center / cover no-repeat,
    #0b1018;
  display: grid;
  gap: clamp(1.25rem, 2.4vw, 2.5rem);
  grid-template-columns: minmax(360px, 480px) minmax(560px, 1fr);
  justify-content: center;
  min-height: 100vh;
  padding: clamp(1.25rem, 4vw, 4rem);
  position: relative;
}

.auth-shell::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  content: "";
  inset: 0;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.95), transparent 75%);
  pointer-events: none;
  position: absolute;
}

.auth-card,
.auth-status-panel {
  animation: auth-rise 580ms ease-out both;
  backdrop-filter: blur(18px);
  background: rgba(16, 24, 36, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.38);
  position: relative;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
  z-index: 1;
}

.auth-card:hover,
.auth-status-panel:hover {
  border-color: rgba(225, 194, 96, 0.32);
  box-shadow: 0 34px 84px rgba(0, 0, 0, 0.46), 0 0 0 1px rgba(225, 194, 96, 0.08);
  transform: translateY(-2px);
}

.auth-card {
  justify-self: end;
  max-width: 480px;
  padding: clamp(1.5rem, 3vw, 2.35rem);
  width: 100%;
}

.auth-brand {
  align-items: center;
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.auth-logo {
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(219, 31, 54, 0.24);
  height: 72px;
  object-fit: contain;
  padding: 0.35rem;
  transition: box-shadow 180ms ease, transform 180ms ease;
  width: 72px;
}

.auth-card:hover .auth-logo {
  box-shadow: 0 18px 42px rgba(219, 31, 54, 0.34);
  transform: scale(1.03);
}

.auth-eyebrow {
  color: #e1c260;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 0.25rem;
  text-transform: uppercase;
}

.auth-brand h1 {
  color: #ffffff;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  line-height: 1.12;
  margin: 0;
}

.auth-subtitle {
  color: #aebbd0;
  margin: 0 0 1.5rem;
}

.auth-form {
  display: grid;
  gap: 1rem;
}

.auth-alert:empty {
  display: none;
}

.auth-field .form-control {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  min-height: 58px;
}

.auth-field .form-control:focus {
  background: rgba(255, 255, 255, 0.11);
  border-color: #e1c260;
  box-shadow: 0 0 0 0.22rem rgba(225, 194, 96, 0.2);
}

.auth-field .form-control::placeholder {
  color: transparent;
}

.auth-field label {
  color: #bac7da;
}

.auth-submit,
.auth-dev-submit {
  border-radius: 8px;
  font-weight: 700;
  min-height: 48px;
  transition: box-shadow 180ms ease, transform 180ms ease, background 180ms ease, color 180ms ease;
}

.auth-submit {
  background: linear-gradient(135deg, #d9203a, #a30d27);
  border: 0;
  color: #ffffff;
  box-shadow: 0 16px 34px rgba(217, 32, 58, 0.26);
}

.auth-submit:hover,
.auth-submit:focus {
  background: linear-gradient(135deg, #eb3149, #b4132d);
  box-shadow: 0 20px 42px rgba(217, 32, 58, 0.34);
  color: #ffffff;
  transform: translateY(-1px);
}

.auth-dev-submit {
  border: 1px solid rgba(225, 194, 96, 0.5);
  color: #f5df91;
}

.auth-dev-submit:hover,
.auth-dev-submit:focus {
  background: rgba(225, 194, 96, 0.12);
  color: #ffffff;
  transform: translateY(-1px);
}

.auth-divider {
  align-items: center;
  color: #8796ad;
  display: flex;
  font-size: 0.85rem;
  gap: 0.75rem;
  margin: 1.1rem 0;
}

.auth-divider::before,
.auth-divider::after {
  background: rgba(255, 255, 255, 0.14);
  content: "";
  flex: 1;
  height: 1px;
}

.auth-status-panel {
  animation-delay: 100ms;
  align-items: stretch;
  align-self: auto;
  display: grid;
  gap: 1.1rem;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  justify-self: stretch;
  height: 100%;
  min-height: 0;
  padding: clamp(1.5rem, 2.6vw, 2.5rem);
  width: 100%;
}

.auth-status-header {
  align-items: center;
  color: #dce7f8;
  display: flex;
  flex-direction: row;
  font-weight: 700;
  gap: 0.65rem;
  justify-content: flex-start;
  line-height: 1.35;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
}

.auth-status-dot {
  animation: auth-pulse 1.8s ease-in-out infinite;
  background: #24c46b;
  border-radius: 50%;
  box-shadow: 0 0 0 8px rgba(36, 196, 107, 0.13);
  display: inline-block;
  height: 10px;
  width: 10px;
}

.auth-status-grid {
  align-content: center;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.auth-status-grid div {
  align-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  display: grid;
  padding: 1rem;
}

.auth-status-grid span {
  color: #92a2b8;
  display: block;
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
}

.auth-status-grid strong {
  color: #ffffff;
  display: block;
  font-size: clamp(1rem, 2vw, 1.35rem);
}

.auth-timeline {
  display: grid;
  gap: 0.65rem;
  grid-column: 1 / -1;
  overflow: hidden;
}

.auth-timeline span {
  animation: auth-line-glow 2.8s ease-in-out infinite;
  background: linear-gradient(90deg, rgba(225, 194, 96, 0.92), rgba(36, 196, 107, 0.68), rgba(84, 166, 255, 0.5));
  border-radius: 999px;
  display: block;
  height: 9px;
}

.auth-timeline span:nth-child(2) {
  animation-delay: 180ms;
  opacity: 0.76;
  width: 82%;
}

.auth-timeline span:nth-child(3) {
  animation-delay: 360ms;
  opacity: 0.58;
  width: 68%;
}

.auth-timeline span:nth-child(4) {
  animation-delay: 540ms;
  opacity: 0.42;
  width: 48%;
}

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

@keyframes auth-pulse {
  0%, 100% {
    box-shadow: 0 0 0 8px rgba(36, 196, 107, 0.13);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(36, 196, 107, 0.04);
  }
}

@keyframes auth-line-glow {
  0%, 100% {
    filter: brightness(1);
    transform: translateX(0);
  }
  50% {
    filter: brightness(1.25);
    transform: translateX(8px);
  }
}

@media (max-width: 1120px) {
  .auth-shell {
    align-content: center;
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-card {
    justify-self: center;
  }

  .auth-status-panel {
    grid-template-columns: 1fr;
    justify-self: center;
    margin: 0 auto;
    max-width: 720px;
    min-height: 0;
  }

  .auth-status-header {
    flex-direction: row;
  }
}

@media (max-width: 992px) {
  .metric-grid,
  .dashboard-columns,
  .admin-form,
  .admin-form-grid,
  .admin-form-grid--wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-shell {
    align-content: center;
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-card {
    margin: 0 auto;
    max-width: 480px;
    width: 100%;
  }

  .auth-status-panel {
    grid-template-columns: 1fr;
    margin: 0 auto;
    max-width: 720px;
  }
}

@media (max-width: 640px) {
  .page-head {
    display: block;
  }

  .metric-grid,
  .dashboard-columns,
  .admin-form,
  .admin-form-grid,
  .admin-form-grid--wide {
    grid-template-columns: 1fr;
  }

  .admin-form-wide,
  .admin-form-actions {
    grid-column: span 1;
  }

  .system-filter {
    margin-top: 1rem;
    min-width: 0;
  }

  .report-filter,
  .trend-row,
  .sneat-form-grid {
    grid-template-columns: 1fr;
  }

  .pager-row {
    align-items: stretch;
    flex-direction: column;
  }

  .sneat-form-grid .span-2 {
    grid-column: span 1;
  }

  .sneat-actions {
    justify-content: flex-start;
  }

  .auth-shell {
    padding: 1rem;
  }

  .auth-brand {
    align-items: flex-start;
  }

  .auth-logo {
    height: 60px;
    width: 60px;
  }

  .auth-status-grid {
    grid-template-columns: 1fr;
  }

  .auth-status-panel {
    gap: 1rem;
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .auth-status-panel,
  .auth-status-dot,
  .auth-timeline span {
    animation: none;
  }

  .auth-card,
  .auth-status-panel,
  .auth-logo,
  .auth-submit,
  .auth-dev-submit {
    transition: none;
  }
}
