:root {
  --header-h: 70px;
  --bg-0: #f4f7f5;
  --bg-1: #ffffff;
  --ink-0: #13201a;
  --ink-1: #3c4d44;
  --line: #d6e1d9;
  --brand-0: #0f8a5f;
  --brand-1: #066847;
  --warn: #f6a400;
  --danger: #d33b32;
  --radius: 14px;
}

body.app-shell {
  font-family: "Manrope", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink-0);
  background:
    radial-gradient(1200px 500px at 95% -10%, rgba(15, 138, 95, 0.13), transparent 55%),
    radial-gradient(900px 440px at -10% 0%, rgba(6, 104, 71, 0.09), transparent 58%),
    var(--bg-0);
}

.app-nav {
  min-height: var(--header-h);
  background: linear-gradient(90deg, #0e2a21 0%, #143228 100%);
  box-shadow: 0 10px 20px rgba(12, 21, 17, 0.2);
}

.app-brand {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.app-nav-btn {
  border-color: rgba(255, 255, 255, 0.45);
}

.app-main {
  min-height: calc(100vh - var(--header-h));
}

.app-layout {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
}

.app-sidebar-col {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(241, 249, 244, 0.9) 100%);
}

.app-sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 1rem 0.7rem;
}

.app-sidebar-section + .app-sidebar-section {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.app-sidebar-title {
  padding: 0 0.55rem;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-1);
  font-weight: 700;
}

.app-sidebar-link {
  display: block;
  padding: 0.45rem 0.55rem;
  border-radius: 9px;
  color: var(--ink-0);
  text-decoration: none;
  font-weight: 600;
}

.app-sidebar-link:hover {
  background: #eef7f2;
}

.app-sidebar-link.is-active {
  background: linear-gradient(90deg, rgba(15, 138, 95, 0.16), rgba(15, 138, 95, 0.06));
  color: #0e5c40;
}

.app-sidebar-parent {
  padding: 0.45rem 0.55rem 0.25rem;
  color: var(--ink-1);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.app-sidebar-parent.is-active {
  color: #0e5c40;
}

.app-sidebar-sub {
  margin: 0 0 0.25rem 0.4rem;
  padding-left: 0.35rem;
  border-left: 2px solid #d8e7de;
}

.app-sidebar-sub-link {
  display: block;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  color: var(--ink-0);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.app-sidebar-sub-link:hover {
  background: #eef7f2;
}

.app-sidebar-sub-link.is-active {
  background: linear-gradient(90deg, rgba(15, 138, 95, 0.16), rgba(15, 138, 95, 0.06));
  color: #0e5c40;
}

.app-main-content {
  min-height: calc(100vh - var(--header-h));
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 22px rgba(18, 41, 31, 0.06) !important;
}

.card .card-body {
  color: var(--ink-0);
}

.login-wrap {
  min-height: calc(100vh - 170px);
  align-items: center;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.login-card {
  overflow: hidden;
}

.login-panel {
  background:
    radial-gradient(330px 200px at 20% -20%, rgba(255, 255, 255, 0.25), transparent 60%),
    linear-gradient(145deg, #0f8a5f 0%, #0a6f4d 100%);
  color: #ffffff;
}

.login-panel .text-muted {
  color: rgba(255, 255, 255, 0.82) !important;
}

.login-panel-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
}

.login-kicker {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  font-weight: 700;
  margin-bottom: 0.9rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  width: fit-content;
}

.login-form-wrap {
  max-width: 420px;
}

.login-form .form-label {
  font-weight: 600;
  color: var(--ink-1);
}

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

.table thead th {
  border-bottom-width: 1px;
  border-color: var(--line);
  color: var(--ink-1);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}

.table > :not(caption) > * > * {
  border-color: var(--line);
  padding: 0.75rem 0.9rem;
  vertical-align: middle;
}

.table.table-sm > :not(caption) > * > * {
  padding: 0.62rem 0.8rem;
}

.table-hover > tbody > tr:hover > * {
  background-color: #f0f7f3;
}

.btn-primary {
  --bs-btn-bg: var(--brand-0);
  --bs-btn-border-color: var(--brand-0);
  --bs-btn-hover-bg: var(--brand-1);
  --bs-btn-hover-border-color: var(--brand-1);
  --bs-btn-active-bg: var(--brand-1);
  --bs-btn-active-border-color: var(--brand-1);
  border-radius: 10px;
}

.btn-outline-primary {
  --bs-btn-color: var(--brand-0);
  --bs-btn-border-color: var(--brand-0);
  --bs-btn-hover-bg: var(--brand-0);
  --bs-btn-hover-border-color: var(--brand-0);
  border-radius: 10px;
}

.btn-outline-secondary,
.btn-outline-danger {
  border-radius: 10px;
}

.form-control,
.form-select,
textarea.form-control {
  border-color: var(--line);
  border-radius: 10px;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
  border-color: #7ec4aa;
  box-shadow: 0 0 0 0.2rem rgba(15, 138, 95, 0.16);
}

.badge {
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.alert {
  border: 1px solid transparent;
  border-radius: 12px;
}

.alert-success {
  border-color: #bde4d0;
  background-color: #eaf8f0;
  color: #12553a;
}

.alert-danger {
  border-color: #efc5c2;
  background-color: #fbeeee;
  color: #6e201b;
}

.alert-info {
  border-color: #cde6ef;
  background-color: #edf8fc;
  color: #1e4e61;
}

.progress {
  background-color: #deebe4;
  border-radius: 999px;
}

.progress-bar {
  background: linear-gradient(90deg, var(--brand-0) 0%, #26b580 100%);
}

.dash-hero {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.85), rgba(240, 250, 245, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.page-hero {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.9), rgba(239, 250, 245, 0.95));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.dash-actions {
  max-width: 48%;
}

.dash-quick-bar {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.92), rgba(239, 250, 245, 0.9));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
}

.dash-cta-row .dash-cta-btn {
  border-radius: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 0.42rem 0.72rem;
}

.dash-cta-primary {
  box-shadow: 0 8px 16px rgba(15, 138, 95, 0.26);
}

.dash-cta-secondary {
  border-width: 2px;
  background: #ffffff;
}

.dash-cta-row .dash-cta-btn:hover {
  transform: translateY(-1px);
}

.dash-stat-card {
  background: linear-gradient(180deg, #ffffff 0%, #f6fbf8 100%);
}

.dash-stat-card .h3 {
  font-weight: 700;
}

.dash-need-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.dash-link {
  color: var(--ink-0);
  text-decoration: none;
  font-weight: 600;
}

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

.admin-users-hero {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.85), rgba(240, 250, 245, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.admin-users-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.admin-users-stat-chip {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #d2e4da;
  background: #f6fbf8;
  font-size: 0.78rem;
  color: var(--ink-1);
}

.admin-users-table-head {
  background: linear-gradient(90deg, rgba(247, 252, 249, 1), rgba(241, 250, 245, 1));
}

.admin-users-actions .btn {
  margin-left: 0.35rem;
}

.manufacturers-hero {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.9), rgba(239, 250, 245, 0.95));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.manufacturers-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.manufacturers-stat-chip {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #d2e4da;
  background: #f6fbf8;
  font-size: 0.78rem;
  color: var(--ink-1);
}

.manufacturers-table-head {
  background: linear-gradient(90deg, rgba(247, 252, 249, 1), rgba(241, 250, 245, 1));
}

.manufacturers-actions .btn {
  margin-left: 0.3rem;
}

.manufacturers-website {
  display: inline-block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.health-hero {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.9), rgba(237, 248, 243, 0.95));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1.05rem;
}

.health-stat-card .h3 {
  font-weight: 700;
}

.health-key {
  width: 280px;
}

.health-value-text {
  font-weight: 500;
}

.health-value-ok {
  color: #166247;
}

.health-value-warn {
  color: #7a5a00;
}

.health-value-fail {
  color: #8a1e17;
}

.health-log-card {
  overflow: hidden;
}

.health-log-pre {
  margin: 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fbf9;
  white-space: pre-wrap;
  max-height: 360px;
  overflow: auto;
  font-size: 0.82rem;
  line-height: 1.4;
}

.stage-dropzone {
  min-height: 220px;
  padding: 0.45rem;
  border: 1px dashed #bfd4c8;
  border-radius: 12px;
  background: #f8fcfa;
  gap: 0.45rem;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap;
  align-content: flex-start;
}

.stage-item {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
  border: 1px solid #cde2d6;
  border-radius: 999px !important;
  background: #ffffff;
  color: var(--ink-0);
  font-weight: 600;
  font-size: 0.84rem;
  padding: 0.3rem 0.65rem;
  margin: 0;
  user-select: none;
  cursor: grab;
}

.stage-dropzone .stage-item.list-group-item {
  width: auto;
  border-radius: 999px !important;
}

.stage-item:hover {
  border-color: #a8cdb9;
  background: #f3faf6;
}

.stage-item:active {
  cursor: grabbing;
}

tbody[data-reorder-url] tr[data-question-id] {
  cursor: move;
}

.questions-key-cell code {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 768px) {
  .app-nav .btn {
    padding-inline: 0.45rem;
  }

  .app-main {
    min-height: auto;
  }

  .app-main-content {
    min-height: auto;
  }

  .table-responsive {
    border-radius: var(--radius);
  }

  .table > :not(caption) > * > * {
    padding: 0.6rem 0.7rem;
  }

  .dash-hero {
    flex-direction: column;
    gap: 0.75rem;
  }

  .dash-actions {
    max-width: 100%;
    text-align: left !important;
  }

  .dash-quick-bar {
    padding: 0.75rem 0.85rem;
  }

  .admin-users-hero {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.65rem;
  }

  .admin-users-actions .btn {
    margin-top: 0.35rem;
  }

  .admin-users-stats {
    gap: 0.35rem;
  }

  .manufacturers-hero {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.65rem;
  }

  .manufacturers-stats {
    gap: 0.35rem;
  }

  .manufacturers-actions .btn {
    margin-top: 0.35rem;
  }

  .manufacturers-website {
    max-width: 180px;
  }

  .health-hero {
    padding: 0.8rem 0.9rem;
  }

  .health-key {
    width: auto;
  }

  .login-wrap {
    min-height: auto;
    padding-top: 0.6rem;
    padding-bottom: 0;
  }

  .login-form-wrap {
    max-width: none;
  }
}
