:root {
  --bg: #05070b;
  --bg-2: #081018;
  --panel: rgba(12, 18, 28, 0.82);
  --panel-strong: rgba(18, 26, 38, 0.94);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(0, 208, 156, 0.34);
  --text: #f7fbff;
  --muted: #9daabc;
  --faint: #657286;
  --accent: #00e39f;
  --accent-dark: #06150f;
  --blue: #5eb0ff;
  --danger: #ff647c;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 14% 12%, rgba(0, 227, 159, 0.18), transparent 27rem),
    radial-gradient(circle at 86% 10%, rgba(94, 176, 255, 0.12), transparent 24rem),
    linear-gradient(180deg, #05070b 0%, #081018 56%, #05070b 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent 72%);
}

.pin-gate {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.pin-card {
  width: min(100%, 420px);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(14, 22, 33, 0.94), rgba(8, 13, 21, 0.94));
  box-shadow: var(--shadow);
  padding: 30px;
}

.logo-row,
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(0, 227, 159, 0.46);
  border-radius: 8px;
  background: #071610;
  color: var(--accent);
  font-weight: 950;
  line-height: 1;
}

.pin-card h1 {
  margin: 28px 0 8px;
  font-size: clamp(2.4rem, 7vw, 4rem);
  line-height: 0.95;
}

.pin-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

.pin-card small {
  display: block;
  min-height: 20px;
  margin-top: 12px;
  color: var(--danger);
  font-weight: 750;
}

.app-shell {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  min-height: 100vh;
}

aside {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(5, 9, 15, 0.78);
  backdrop-filter: blur(18px);
  padding: 28px;
}

.brand {
  margin-bottom: 38px;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 950;
  text-decoration: none;
}

nav {
  display: grid;
  gap: 8px;
  margin-bottom: 32px;
}

nav a {
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 850;
  padding: 11px 12px;
  text-decoration: none;
}

nav a:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

aside p,
header p,
.panel-heading p {
  color: var(--muted);
  line-height: 1.55;
}

main {
  width: min(100%, 1220px);
  padding: 34px;
}

header,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

h1,
h2,
p {
  margin: 0;
}

header h1 {
  font-size: clamp(2.15rem, 5vw, 4.2rem);
  letter-spacing: 0;
  line-height: 0.95;
}

h2 {
  font-size: 1.06rem;
  letter-spacing: 0;
}

.panel {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  padding: 20px;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: end;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

input,
select,
button {
  min-height: 44px;
  border-radius: 8px;
  font: inherit;
  letter-spacing: 0;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(2, 7, 12, 0.72);
  color: var(--text);
  outline: none;
  padding: 0 13px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 227, 159, 0.12);
}

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 950;
  padding: 0 16px;
}

button:hover {
  filter: brightness(1.06);
}

button.secondary {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.model-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.model-form label:first-child {
  grid-column: span 2;
}

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

td a {
  display: block;
  max-width: 520px;
  margin-top: 4px;
  color: var(--blue);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

td button {
  min-height: 34px;
  margin-right: 8px;
  padding: 0 12px;
}

.status,
code,
.secret-box {
  border: 1px solid rgba(0, 227, 159, 0.22);
  border-radius: 6px;
  background: rgba(0, 227, 159, 0.08);
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, monospace;
  padding: 4px 7px;
}

.secret-box {
  margin-top: 16px;
  overflow-wrap: anywhere;
  padding: 12px;
}

.events {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.events article {
  display: grid;
  grid-template-columns: 170px 1fr auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(2, 7, 12, 0.56);
  padding: 12px;
}

.events span,
.events time {
  color: var(--muted);
}

#authStatus {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  padding-bottom: 12px;
}

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

  aside {
    position: static;
    height: auto;
  }

  main {
    padding: 24px;
  }

  header,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-panel,
  .model-form,
  .events article {
    grid-template-columns: 1fr;
  }

  .model-form label:first-child {
    grid-column: span 1;
  }
}
