:root {
  color-scheme: light;
  --bg: #eef3f8;
  --bg-2: #dfe7ef;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --text: #17202f;
  --muted: #667085;
  --line: rgba(29, 41, 57, 0.12);
  --blue: #2563eb;
  --cyan: #0891b2;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --shadow: 0 18px 45px rgba(23, 32, 47, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(37, 99, 235, 0.16), transparent 28rem),
    radial-gradient(circle at 90% 0%, rgba(8, 145, 178, 0.13), transparent 22rem),
    linear-gradient(135deg, var(--bg), var(--bg-2));
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 16px clamp(16px, 4vw, 42px);
  background: rgba(239, 244, 249, 0.76);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-weight: 800;
  white-space: nowrap;
}

.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
}

.topnav {
  justify-self: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
}

.topnav a {
  padding: 9px 14px;
  border-radius: 999px;
  color: #344054;
  font-size: 0.92rem;
  transition: 0.18s ease;
}

.topnav a:hover,
.topnav a.active {
  color: #fff;
  background: #17202f;
  box-shadow: 0 8px 22px rgba(23, 32, 47, 0.18);
}

.logout button,
.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.logout {
  margin: 0;
}

.ico {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell,
.auth-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 54px;
}

.auth-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.auth-shell::before {
  content: "";
  position: absolute;
  width: min(720px, 88vw);
  height: min(420px, 62vh);
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04)),
    linear-gradient(90deg, rgba(37, 99, 235, 0.18), rgba(8, 145, 178, 0.1));
  box-shadow: 0 34px 90px rgba(23, 32, 47, 0.22);
  transform: perspective(900px) rotateX(58deg) rotateZ(-7deg) translateY(20px);
  animation: floatPanel 8s ease-in-out infinite;
  backdrop-filter: blur(12px);
}

@keyframes floatPanel {
  0%,
  100% {
    transform: perspective(900px) rotateX(58deg) rotateZ(-7deg) translateY(20px);
  }

  50% {
    transform: perspective(900px) rotateX(58deg) rotateZ(-7deg) translateY(4px);
  }
}

.auth-card,
.panel,
.table-wrap,
.status-hero,
.metric {
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  padding: 34px;
  text-align: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.auth-card h1,
.page-head h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1;
}

.auth-card h1 {
  font-size: clamp(2.4rem, 8vw, 4.4rem);
  font-weight: 850;
}

.auth-card p,
.page-head p {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 650;
}

.auth-title p {
  margin-top: 12px;
  text-transform: lowercase;
  font-size: 1.02rem;
  color: #344054;
}

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

.stack {
  margin-top: 26px;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.86);
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(37, 99, 235, 0.72);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.primary,
.month-filter button,
.quick-actions a {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #17202f, #2563eb);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.2);
  cursor: pointer;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  color: var(--blue);
  font-weight: 750;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 18px 0 24px;
}

.month-filter {
  display: flex;
  align-items: end;
  gap: 10px;
}

.month-filter label {
  min-width: 160px;
}

.status-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-radius: 8px;
  margin-bottom: 18px;
}

.status-hero span,
.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-hero strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.8rem, 5vw, 3rem);
}

.status-hero p {
  max-width: 520px;
  margin: 0;
  color: #344054;
  font-weight: 700;
}

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

.insight-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric {
  min-height: 144px;
  display: grid;
  align-content: space-between;
  padding: 20px;
  border-radius: 8px;
}

.metric strong {
  margin-top: 12px;
  font-size: clamp(1.45rem, 2.8vw, 2.15rem);
  line-height: 1;
}

.metric small {
  color: var(--muted);
  font-weight: 700;
}

.healthy {
  border-color: rgba(5, 150, 105, 0.24);
}

.warning {
  border-color: rgba(217, 119, 6, 0.3);
}

.critical {
  border-color: rgba(220, 38, 38, 0.28);
}

.healthy strong,
.healthy .pill {
  color: var(--green);
}

.warning strong,
.warning .pill {
  color: var(--amber);
}

.critical strong,
.critical .pill {
  color: var(--red);
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.panel {
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 18px;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.grid-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.wide {
  grid-column: span 2;
}

.check {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.check input {
  width: 18px;
  min-height: 18px;
}

.table-wrap {
  overflow: hidden;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.58);
}

th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  font-weight: 650;
}

tr:last-child td {
  border-bottom: 0;
}

.actions-col {
  width: 150px;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row-actions form {
  margin: 0;
}

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

.empty {
  padding: 34px;
  color: var(--muted);
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.72);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.user-list {
  display: grid;
  gap: 10px;
}

.user-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.user-delete {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 10px;
}

.user-list span,
.dev-link {
  color: var(--muted);
}

.flash {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 8px;
  color: #065f46;
  background: rgba(209, 250, 229, 0.9);
  font-weight: 750;
}

.flash.danger {
  color: #991b1b;
  background: rgba(254, 226, 226, 0.9);
}

@media (max-width: 920px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .topnav {
    grid-column: 1 / -1;
    order: 3;
    width: 100%;
    border-radius: 18px;
  }

  .metrics-grid,
  .insight-row,
  .grid-form,
  .user-editor,
  .split {
    grid-template-columns: 1fr 1fr;
  }

  .wide {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .brand span:last-child {
    display: none;
  }

  .topnav {
    justify-content: start;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .page-head,
  .status-hero,
  .month-filter {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics-grid,
  .insight-row,
  .grid-form,
  .user-editor,
  .split {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: span 1;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }

  td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 0;
    padding: 8px;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 800;
  }

  .row-actions {
    justify-content: flex-end;
  }

  .row-actions::before {
    content: "";
  }
}
