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

/* ===== GLOBAL ===== */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, #1f2937 0, #020617 45%),
    radial-gradient(circle at bottom right, #020617 0, #000000 60%);
  color: #e5e7eb;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
}

/* ===== APP SHELL ===== */
.app-container {
  width: 100%;
  max-width: 1080px;
  background: rgba(15,23,42,0.96);
  border-radius: 22px;
  border: 1px solid rgba(148,163,184,0.25);
  box-shadow:
    0 24px 60px rgba(0,0,0,0.75),
    0 0 0 1px rgba(15,23,42,0.9);
  padding: 18px 18px 20px;
  position: relative;
  overflow: hidden;
}

.app-container::before {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 5% 0, rgba(56,189,248,0.16) 0, transparent 55%),
    radial-gradient(circle at 95% 100%, rgba(129,140,248,0.18) 0, transparent 55%);
  opacity: 0.9;
  pointer-events: none;
  z-index: -1;
}

/* ===== HEADER / TOPBAR ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(31,41,55,0.9);
  margin-bottom: 14px;
}

.app-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-header h1 {
  font-size: 1.45rem;
  color: #f9fafb;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.app-header h1::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: conic-gradient(from 140deg, #38bdf8, #6366f1, #22c55e, #38bdf8);
  box-shadow: 0 0 24px rgba(56,189,248,0.9);
}

.app-header span.logo-tag {
  font-size: 0.78rem;
  color: #9ca3af;
}

.app-header-right {
  text-align: right;
  font-size: 0.8rem;
  color: #9ca3af;
}

/* top links */
nav {
  margin-top: 4px;
}

nav a {
  color: #e5e7eb;
  text-decoration: none;
  font-size: 0.82rem;
  margin-left: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

nav a:hover {
  background: rgba(15,23,42,0.95);
  border-color: rgba(55,65,81,0.95);
  color: #38bdf8;
}

/* ===== CARDS / SECTIONS ===== */
.card {
  background: rgba(15,23,42,0.94);
  border-radius: 18px;
  border: 1px solid rgba(31,41,55,0.95);
  padding: 14px 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 18px 40px rgba(15,23,42,0.85);
  backdrop-filter: blur(16px);
}

.card h2 {
  font-size: 1rem;
  margin-bottom: 6px;
}

/* ===== FORMS ===== */
label {
  display: block;
  font-size: 0.84rem;
  margin-bottom: 4px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #374151;
  background: rgba(17,24,39,0.96);
  color: #e5e7eb;
  font-size: 0.9rem;
  outline: none;
  transition: border 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56,189,248,0.38);
  background: rgba(15,23,42,1);
}

textarea {
  resize: vertical;
  min-height: 100px;
  font-family: monospace;
  line-height: 1.4;
}

.row {
  margin-bottom: 10px;
}

.inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inline > div {
  flex: 1 1 140px;
}

/* ===== BUTTONS ===== */
button {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.9rem;
  cursor: pointer;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(37,99,235,0.7);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

button.btn-secondary {
  background: rgba(15,23,42,0.98);
  border: 1px solid #374151;
  box-shadow: none;
}

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

button:active {
  transform: scale(0.97) translateY(1px);
  box-shadow: 0 6px 18px rgba(37,99,235,0.72);
}

/* ===== TEXT / BADGE / UTILS ===== */
.hint {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 3px;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15,23,42,0.98);
  border: 1px solid #1f2937;
  color: #9ca3af;
  margin-left: 6px;
}

.small {
  font-size: 0.8rem;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

a.link {
  color: #38bdf8;
  text-decoration: none;
  word-break: break-all;
}

a.link:hover {
  text-decoration: underline;
}

/* ===== TABLES ===== */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  table-layout: fixed;
}

.table th,
.table td {
  border-bottom: 1px solid #1f2937;
  padding: 6px 6px;
  vertical-align: top;
  white-space: normal;
  word-break: break-all;
}

.table th {
  text-align: left;
  color: #9ca3af;
  font-weight: 500;
}

.table tr:hover td {
  background: rgba(15,23,42,0.95);
}

/* ===== ALERTS ===== */
.alert {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.8rem;
  margin-bottom: 10px;
}

.alert-error {
  background: #7f1d1d;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #14532d;
  border: 1px solid #bbf7d0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .app-container {
    border-radius: 18px;
    padding: 14px 12px 16px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .app-header-right {
    text-align: left;
  }

  nav a {
    margin-left: 0;
    margin-right: 4px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .app-header h1 {
    font-size: 1.25rem;
  }

  .card {
    padding: 12px 10px 14px;
  }

  input,
  select,
  textarea {
    font-size: 0.85rem;
  }

  button {
    width: 100%;
    justify-content: center;
    display: inline-flex;
    text-align: center;
  }
}
