@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #0f1520;
  --card: #1c2333;
  --card2: #212a3e;
  --text: #e6edf3;
  --muted: #95a1b2;
  --primary: #2f81f7;
  --primary2: #1f6feb;
  --danger: #f85149;
  --success: #3fb950;
  --border: #30363d;
  --shadow: 0 8px 24px rgba(1, 4, 9, 0.55);
  --shadow-soft: 0 18px 40px rgba(1, 4, 9, 0.28);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(47, 129, 247, 0.14), transparent 30%),
    radial-gradient(circle at bottom right, rgba(63, 185, 80, 0.08), transparent 22%),
    linear-gradient(180deg, #0a1018 0%, var(--bg) 100%);
  color: var(--text);
  font: 15px/1.6 "Plus Jakarta Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
}

h2 {
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.2;
}

h3 {
  font-size: 16px;
  line-height: 1.3;
}

p {
  color: var(--muted);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: #8bc2ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
}

.login-background {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(47, 129, 247, 0.12), transparent 45%),
    radial-gradient(circle at 80% 15%, rgba(63, 185, 80, 0.08), transparent 30%);
  pointer-events: none;
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
}

.login-card {
  background: linear-gradient(180deg, rgba(28, 35, 51, 0.96) 0%, rgba(17, 24, 39, 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  padding: 40px 32px;
  backdrop-filter: blur(16px);
}

.login-card-wide {
  padding: 40px 34px 30px;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(47, 129, 247, 0.28), rgba(47, 129, 247, 0.12));
  border: 1px solid rgba(47, 129, 247, 0.35);
  color: #d9ebff;
  font-size: 24px;
  font-weight: 800;
}

.login-subtitle {
  max-width: 420px;
  margin: 10px auto 0;
}

.login-footer {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.login-footer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mini-note {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 14px;
}

.mini-note strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 13px;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  background: rgba(10, 16, 24, 0.86);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-inner {
  max-width: 1240px;
  height: 66px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #8bc2ff;
  font-size: 17px;
  font-weight: 800;
}

.logo svg {
  stroke: currentColor;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-links a,
.nav-button {
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: 0.18s ease;
}

.nav-links a:hover,
.nav-links a.nav-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.hero-panel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
  padding: 28px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(135deg, rgba(47, 129, 247, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(28, 35, 51, 0.96) 0%, rgba(18, 25, 37, 0.96) 100%);
  box-shadow: var(--shadow);
}

.hero-actions {
  flex-shrink: 0;
}

.header-subtitle {
  margin-top: 10px;
  max-width: 680px;
}

.refresh-meta {
  margin-top: 12px;
  font-size: 13px;
  color: #8ea0b8;
}

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

.summary-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.summary-card h2 {
  margin-bottom: 8px;
  font-size: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(28, 35, 51, 0.96), rgba(16, 23, 35, 0.96));
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 129, 247, 0.4);
}

.stat-card.error:hover {
  border-color: rgba(248, 81, 73, 0.4);
}

.stat-icon {
  min-width: 64px;
  height: 64px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(47, 129, 247, 0.12);
  color: #cce4ff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card.error .stat-icon {
  background: rgba(248, 81, 73, 0.12);
  color: #ffb7b2;
}

.stat-content {
  flex: 1;
}

.stat-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-value {
  color: var(--text);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.actions-section,
.tables-section {
  margin-bottom: 34px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(28, 35, 51, 0.96), rgba(16, 23, 35, 0.96));
  box-shadow: var(--shadow);
}

.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.card-body {
  padding: 20px;
}

.stack-form {
  display: grid;
  gap: 12px;
}

.form-group {
  display: grid;
  gap: 8px;
}

.form-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: var(--bg3);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

input::placeholder,
textarea::placeholder {
  color: #778396;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(47, 129, 247, 0.7);
  box-shadow: 0 0 0 4px rgba(47, 129, 247, 0.12);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--primary);
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--primary), var(--primary2));
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}

button:hover,
.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  transform: none;
}

.btn-light,
.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.btn-secondary {
  width: auto;
  min-width: 140px;
}

.btn-light:hover,
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.msg {
  display: none;
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 600;
  animation: slideIn 0.2s ease-out;
}

.msg.ok,
.msg.err {
  display: block;
}

.msg.ok {
  background: rgba(63, 185, 80, 0.12);
  border: 1px solid rgba(63, 185, 80, 0.28);
  color: #8ce39a;
}

.msg.err {
  background: rgba(248, 81, 73, 0.12);
  border: 1px solid rgba(248, 81, 73, 0.28);
  color: #ffb7b2;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  background: var(--bg3);
}

.data-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.data-toolbar-left,
.data-toolbar-actions,
.table-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(47, 129, 247, 0.12);
  border: 1px solid rgba(47, 129, 247, 0.25);
  color: #b7d7ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toolbar-meta {
  color: var(--muted);
  font-size: 13px;
}

.table-search {
  width: min(280px, 100%);
  min-height: 40px;
}

.table-pagination {
  justify-content: space-between;
  margin-top: 14px;
}

.mobile-table-cards {
  display: none;
}

.mobile-data-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mobile-data-card + .mobile-data-card {
  margin-top: 12px;
}

.mobile-data-card-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mobile-data-item {
  display: grid;
  gap: 4px;
}

.mobile-data-item span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mobile-data-item strong {
  color: var(--text);
  font-size: 14px;
  word-break: break-word;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #182233;
  color: #9db5cf;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

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

.stack-form.is-loading {
  opacity: 0.78;
}

.stack-form.is-loading input,
.stack-form.is-loading textarea,
.stack-form.is-loading select {
  opacity: 0.9;
}

@media (max-width: 1000px) {
  .stats-grid,
  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .nav-inner,
  .hero-panel,
  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions,
  .btn-secondary {
    width: 100%;
  }

  .stats-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .login-card,
  .card {
    border-radius: 18px;
  }

  .login-footer-grid {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 18px 12px 48px;
  }

  .card-body {
    padding: 16px;
  }

  .nav-inner {
    height: auto;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .data-toolbar,
  .data-toolbar-actions,
  .table-pagination {
    align-items: stretch;
  }

  .data-toolbar-actions,
  .table-search,
  .table-pagination button {
    width: 100%;
  }

  .table-wrap {
    display: none;
  }

  .mobile-table-cards {
    display: block;
  }

  .table-pagination {
    justify-content: stretch;
  }
}
