:root {
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #d8dee8;
  --surface: #ffffff;
  --page: #f4f7fb;
  --blue: #2563eb;
  --blue-soft: #e8f0ff;
  --green: #047857;
  --green-soft: #e5f6ef;
  --amber: #b45309;
  --amber-soft: #fff4db;
  --danger: #b91c1c;
}

html {
  font-size: 15px;
  min-height: 100%;
  position: relative;
}

body {
  background: var(--page);
  color: var(--ink);
  min-height: 100vh;
  margin: 0;
}

a {
  text-decoration: none;
}

.page-container {
  max-width: 1180px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
}

.navbar-brand {
  color: #0f766e;
}

.navbar .nav-link {
  color: #374151;
  font-weight: 600;
}

.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: var(--blue);
}

.nav-user {
  flex-wrap: wrap;
}

.app-main {
  padding: 28px 0 48px;
}

.app-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 18px 0;
  background: #fff;
}

.page-heading {
  align-items: flex-end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-heading h1 {
  font-size: clamp(1.65rem, 2.5vw, 2.35rem);
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 8px;
}

.eyebrow {
  color: #0f766e;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.heading-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.form-actions {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 18px;
}

.panel,
.auth-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(31, 41, 55, 0.06);
  padding: 22px;
}

.panel-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: -2px 0 18px;
  padding-bottom: 14px;
}

.panel-header h2,
.danger-panel h2 {
  font-size: 1.08rem;
  font-weight: 800;
  margin: 0;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 118px;
  padding: 20px;
}

.stat-card span {
  color: var(--muted);
  display: block;
  font-weight: 700;
  margin-bottom: 16px;
}

.stat-card strong {
  display: block;
  font-size: 2.2rem;
  line-height: 1;
}

.stat-blue {
  background: var(--blue-soft);
  border-color: #c7d7fe;
}

.stat-green {
  background: var(--green-soft);
  border-color: #b8ead6;
}

.stat-amber {
  background: var(--amber-soft);
  border-color: #f6d58f;
}

.toolbar-form {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  margin-bottom: 18px;
}

.compact-toolbar {
  grid-template-columns: minmax(220px, 1fr) auto auto;
}

.table {
  --bs-table-bg: transparent;
}

.table thead th {
  color: #4b5563;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.table td,
.table th {
  padding: 0.9rem 0.75rem;
}

.action-buttons {
  white-space: nowrap;
}

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

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

.detail-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-grid div {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.detail-grid dd {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

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

.stack-item {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  padding: 14px;
}

.stack-item:hover {
  border-color: #93c5fd;
  color: var(--blue);
}

.stack-item small {
  color: var(--muted);
  display: block;
}

.stack-item b {
  background: var(--blue-soft);
  border-radius: 999px;
  color: var(--blue);
  min-width: 36px;
  padding: 6px 10px;
  text-align: center;
}

.danger-panel {
  border-color: #fecaca;
}

.danger-panel h2 {
  color: var(--danger);
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 190px);
  place-items: center;
}

.auth-panel {
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1fr);
  max-width: 880px;
  width: 100%;
}

.auth-panel.wide {
  max-width: 960px;
}

.auth-copy {
  background: #eefaf7;
  border: 1px solid #cceee6;
  border-radius: 8px;
  padding: 24px;
}

.auth-copy h1 {
  font-weight: 800;
  margin-bottom: 12px;
}

.auth-copy p {
  color: var(--muted);
  margin-bottom: 20px;
}

.demo-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.demo-box span {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
}

.demo-box strong {
  display: block;
  margin-top: 3px;
}

.auth-form {
  align-self: center;
}

.auth-switch {
  color: var(--muted);
  margin: 16px 0 0;
  text-align: center;
}

.btn {
  border-radius: 8px;
  font-weight: 700;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
}

.form-control,
.form-select {
  border-color: #cfd8e3;
  border-radius: 8px;
  min-height: 42px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.14);
}

@media (max-width: 768px) {
  .app-main {
    padding-top: 18px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .heading-actions,
  .form-actions {
    justify-content: flex-start;
  }

  .toolbar-form,
  .compact-toolbar {
    grid-template-columns: 1fr;
  }

  .auth-panel,
  .auth-panel.wide {
    grid-template-columns: 1fr;
  }

  .detail-grid,
  .detail-grid.compact {
    grid-template-columns: 1fr;
  }

  .action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    white-space: normal;
  }
}
