:root {
  --app-bg: #f3f6fb;
  --app-surface: #ffffff;
  --app-surface-soft: #f9fbff;
  --app-border: #dde5f1;
  --app-text: #1f2a44;
  --app-muted: #66748e;
  --app-primary: #2c5cf6;
  --app-primary-strong: #1f47c5;
  --app-sidebar: #111827;
  --app-sidebar-accent: #1d4ed8;
  --app-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --app-radius: 0.8rem;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: "Public Sans", "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--app-text);
  background: #f4f6f9;
}

.app-nav-link {
  color: #c7d2e3 !important;
  font-weight: 600;
  border-radius: 0.55rem;
  padding: 0.58rem 0.75rem;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.app-nav-link:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

.app-nav-link.active {
  color: #fff !important;
  background: #0d6efd;
  border-color: #0d6efd;
}

.app-sidebar {
  width: 260px;
  background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
}

.app-sidebar-mobile {
  width: 280px;
  background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
}

.app-header {
  min-height: 60px;
}

.app-main {
  background: #f4f6f9;
  min-width: 0;
}

.app-content {
  width: 100%;
}

.auth-main {
  max-width: 1080px;
}

.card {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  background: var(--app-surface);
}

.card-header {
  background: linear-gradient(180deg, #fbfdff 0%, #f5f9ff 100%);
  border-bottom: 1px solid var(--app-border);
  font-weight: 700;
}

.btn {
  border-radius: 0.6rem;
  font-weight: 600;
}

.smart-choice {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

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

.smart-choice .btn {
  width: 100%;
  border-radius: 0.65rem !important;
  font-weight: 700;
  min-height: 2.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-width: 2px;
}

.parameter-row {
  scroll-margin-top: 88px;
}

.question-summary {
  list-style: none;
  cursor: pointer;
}

.question-summary::-webkit-details-marker {
  display: none;
}

.question-row[open] .question-summary {
  border-bottom: 1px solid var(--app-border);
}

.btn-primary {
  background: linear-gradient(135deg, var(--app-primary), #4069f7);
  border-color: var(--app-primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, var(--app-primary-strong), #2c5cf6);
  border-color: var(--app-primary-strong);
}

.form-control,
.form-select {
  border-radius: 0.6rem;
  border-color: #d3ddeb;
  color: var(--app-text);
}

.form-control:focus,
.form-select:focus {
  border-color: #8fb3ff;
  box-shadow: 0 0 0 0.22rem rgba(44, 92, 246, 0.18);
}

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

.table > :not(caption) > * > * {
  border-bottom-color: #e6ecf5;
  vertical-align: middle;
}

.table thead th {
  color: #4a5872;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 0.75rem;
  font-weight: 700;
}

.list-group-item {
  border-color: #e4ebf5;
}

.badge {
  font-weight: 600;
}

.alert {
  border-radius: 0.7rem;
}

.card-stat .label {
  font-size: 0.78rem;
  color: var(--app-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.card-stat .value {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.05;
}

img {
  object-fit: contain;
  max-height: 220px;
  border-radius: 0.45rem;
}

.example-image {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #f8fbff;
  padding: 0.35rem;
}

.login-shell {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  align-items: stretch;
}

.login-visual {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: linear-gradient(160deg, #f9fbff 0%, #eef4ff 100%);
  padding: 1.2rem;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.12);
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  margin-bottom: 0.75rem;
}

.login-machine {
  position: relative;
  height: 170px;
  background: repeating-linear-gradient(135deg, #dfe8fb, #dfe8fb 14px, #e8eefc 14px, #e8eefc 28px);
  border: 1px solid #cad8f3;
  border-radius: 0.8rem;
  overflow: hidden;
}

.machine-head,
.machine-body,
.machine-base {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 0.4rem;
  background: linear-gradient(180deg, #3d4f6f 0%, #1f2a44 100%);
}

.machine-head { top: 22px; width: 130px; height: 30px; }
.machine-body { top: 56px; width: 220px; height: 70px; }
.machine-base { top: 130px; width: 260px; height: 22px; }

.login-card .card-body {
  padding: 1.2rem;
}

.floating-login-wrapper {
  max-width: 420px;
  margin: 2rem auto;
}

.form-signin {
  width: 100%;
  max-width: 420px;
  padding: 15px;
  margin: auto;
}

.form-signin .checkbox {
  font-weight: 400;
}

.form-signin .form-control {
  position: relative;
  box-sizing: border-box;
  height: auto;
  padding: 10px;
  font-size: 16px;
}

.form-signin .form-control:focus {
  z-index: 2;
}

.floating-field {
  position: relative;
}

.floating-field > label {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  padding: 0.8rem 0.75rem;
  color: #6c757d;
  pointer-events: none;
  border: 1px solid transparent;
  transform-origin: 0 0;
  transition: opacity .12s ease-in-out,transform .12s ease-in-out;
}

.floating-field > input {
  height: calc(3.2rem + 2px);
  padding: 1.25rem .75rem .25rem .75rem;
}

.floating-field > input::placeholder {
  color: transparent;
}

.floating-field > input:focus,
.floating-field > input:not(:placeholder-shown) {
  padding-top: 1.25rem;
  padding-bottom: .25rem;
}

.floating-field > input:focus ~ label,
.floating-field > input:not(:placeholder-shown) ~ label {
  transform: translateY(-0.45rem) scale(.82);
  color: #4f607e;
}

.dynamic-grid {
  border: 1px solid var(--app-border);
  border-radius: 0.7rem;
  padding: 0.8rem;
  background: #fafcff;
}

.dynamic-block {
  border-top: 1px solid #e6ecf5;
  padding-top: 0.65rem;
  margin-top: 0.65rem;
}

.dynamic-block:first-of-type {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.question-row .smart-choice {
  min-width: 240px;
}

@media (max-width: 991.98px) {
  .app-header {
    position: sticky;
    top: 0;
    z-index: 1030;
  }

  .app-content {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  .table {
    font-size: 0.88rem;
  }

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

@media (max-width: 575.98px) {
  .app-content .card-body {
    padding: 0.85rem;
  }

  .app-content .card-header {
    padding: 0.65rem 0.85rem;
  }

  .btn,
  .form-control,
  .form-select {
    font-size: 0.96rem;
  }

  .smart-choice .btn {
    min-height: 3rem;
  }

  .question-row .d-flex.flex-wrap.align-items-center.gap-2 {
    flex-direction: column;
    align-items: stretch !important;
  }

  .question-row .smart-choice {
    width: 100%;
  }
}
