/* ============================================================
   QCreator Analytics — фирменная оболочка аналитического модуля.
   Загружается после style.css и переопределяет только оформление
   рабочей среды, не затрагивая таблицы данных и Statistical View.
   ============================================================ */

:root {
  --qc-blue: #2563eb;
  --qc-blue-dark: #1d4ed8;
  --qc-green: #4f46e5;
  --qc-ink: #0f172a;
  --qc-muted: #64748b;
  --qc-line: #e2e8f0;
  --qc-bg: #f5f7fb;
  --qc-card: #ffffff;
  --qc-radius: 16px;
  --qc-shadow: 0 18px 45px rgba(15, 23, 42, 0.07);
}

html, body {
  font-family: "Inter", "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--qc-ink);
  background: var(--qc-bg);
}

body {
  font-size: 13.5px;
}

/* ---------- верхняя панель приложения ---------- */
.qc-appbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 26px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--qc-line);
  backdrop-filter: saturate(180%) blur(14px);
  position: sticky;
  top: 0;
  z-index: 300;
}

.qc-appbar-left,
.qc-appbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.qc-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--qc-ink);
}

.qc-brand-text {
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.qc-appbar-divider {
  width: 1px;
  height: 26px;
  background: var(--qc-line);
}

.qc-module {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 10px;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  background: #f8fafc;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}

.qc-module:hover {
  color: var(--qc-blue);
  background: #eef4ff;
  border-color: #dbeafe;
}

.qc-project-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #1e40af;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qc-project-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--qc-green);
  flex: 0 0 auto;
}

.qc-user {
  font-size: 12.5px;
  color: var(--qc-muted);
  font-weight: 500;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qc-appbar-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #334155;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: 9px;
  transition: all 0.18s ease;
}

.qc-appbar-link:hover {
  background: #f1f5f9;
  color: var(--qc-blue);
}

.qc-appbar-link-muted {
  color: var(--qc-muted);
  font-weight: 500;
}

/* ---------- строка меню ---------- */
.menubar {
  background: #fff;
  border-bottom: 1px solid var(--qc-line);
  padding: 4px 18px;
  gap: 2px;
  position: sticky;
  top: var(--qc-appbar-offset, 60px);
  z-index: 250;
}

.menubar .brand {
  color: var(--qc-ink);
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
}

.menubar .brand:hover {
  background: #f1f5f9;
  color: var(--qc-blue);
}

.menubar > ul > li > a,
.menubar > ul > li > span {
  padding: 6px 11px;
  border-radius: 8px;
  color: #334155;
  font-weight: 500;
  transition: all 0.15s ease;
}

.menubar > ul > li:hover > a,
.menubar > ul > li:hover > span {
  background: #eef4ff;
  color: var(--qc-blue);
}

.menubar li ul {
  border: 1px solid var(--qc-line);
  border-radius: 12px;
  box-shadow: var(--qc-shadow);
  padding: 6px;
  min-width: 250px;
  background: #fff;
}

.menubar li ul li a,
.menubar li ul li span {
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
}

.menubar li ul li a:hover,
.menubar li ul li:hover > span {
  background: #eef4ff;
  color: var(--qc-blue);
}

.menubar .menu-upload label {
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
}

.menubar .menu-upload label:hover {
  background: #eef4ff;
  color: var(--qc-blue);
}

.menubar .file-label {
  color: var(--qc-muted);
  font-size: 12px;
  background: #f8fafc;
  border: 1px solid var(--qc-line);
  border-radius: 999px;
  padding: 4px 12px;
}

/* ---------- панель инструментов и сообщения ---------- */
.toolbar {
  background: #fff;
  border-bottom: 1px solid var(--qc-line);
  padding: 8px 22px;
  min-height: 38px;
  gap: 10px;
}

.qc-flashes {
  padding: 12px 22px 0;
  display: grid;
  gap: 8px;
}

.flash {
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  border: 1px solid transparent;
}

.flash.ok,
.flash.success {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.flash.error {
  background: #fff;
  background-image: none;
  border-color: #e2e8f0;
  border-left: 3px solid #dc2626;
  color: #b91c1c;
}

.flash.warning {
  background: #fff;
  background-image: none;
  border-color: #e2e8f0;
  border-left: 3px solid #d97706;
  color: #92400e;
}

/* ---------- рабочая область ---------- */
main {
  background: #fff;
  min-height: calc(100vh - 60px - 42px - 42px);
  padding: 20px 22px 26px;
}

main.qc-main {
  background: var(--qc-bg);
}

body.home main {
  padding: 0;
}

/* ---------- нижняя строка состояния ---------- */
.statusbar {
  background: #fff;
  border-top: 1px solid var(--qc-line);
  padding: 6px 18px;
  color: var(--qc-muted);
  min-height: 36px;
}

.statusbar .tab {
  border-radius: 8px 8px 0 0;
  padding: 6px 14px;
  color: var(--qc-muted);
  font-weight: 500;
}

.statusbar .tab:hover {
  background: #f1f5f9;
  color: var(--qc-blue);
}

.statusbar .tab.active {
  background: #eef4ff;
  color: var(--qc-blue);
  border-bottom: 2px solid var(--qc-blue);
}

.statusbar .legal,
.statusbar .legal-link {
  color: #94a3b8;
  font-size: 11.5px;
}

/* ---------- элементы управления ---------- */
.qc-btn,
.btn-primary,
.btn-secondary,
.btn-dark,
button.btn-primary,
button.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 10px;
  padding: 9px 15px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.qc-btn-primary,
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--qc-blue) 0%, var(--qc-blue-dark) 100%);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.22);
}

.qc-btn-primary:hover,
.btn-primary:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.3);
}

.qc-btn-ghost,
.btn-secondary {
  color: #334155;
  background: #fff;
  border-color: var(--qc-line);
}

.qc-btn-ghost:hover,
.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--qc-ink);
}

.qc-btn-block {
  width: 100%;
  margin-top: 8px;
}

.qc-btn-small {
  padding: 7px 12px;
  font-size: 12px;
}

.qc-link {
  color: var(--qc-blue);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}

.qc-link:hover {
  text-decoration: underline;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
  font-family: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 13px;
  background: #fff;
  color: var(--qc-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ---------- домашняя страница модуля ---------- */
.qc-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.9fr);
  gap: 34px;
  padding: 48px 44px 42px;
  background:
    radial-gradient(900px 360px at 10% -10%, rgba(37, 99, 235, 0.13), transparent 60%),
    radial-gradient(700px 300px at 95% 5%, rgba(37, 99, 235, 0.12), transparent 55%),
    #fff;
  border-bottom: 1px solid var(--qc-line);
}

.qc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.qc-hero h1 {
  margin: 16px 0 12px;
  font-size: clamp(30px, 3.6vw, 44px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  font-weight: 800;
  color: var(--qc-ink);
}

.qc-hero-lead {
  max-width: 640px;
  margin: 0 0 22px;
  color: var(--qc-muted);
  font-size: 14.5px;
  line-height: 1.62;
}

.qc-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.qc-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  color: #64748b;
  font-size: 12.5px;
}

.qc-meta-row strong {
  color: var(--qc-ink);
  font-weight: 700;
}

.qc-hero-panel {
  background: #fff;
  border: 1px solid var(--qc-line);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--qc-shadow);
  align-self: start;
}

.qc-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.qc-panel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--qc-green);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13);
}

.qc-dropzone {
  border: 1.5px dashed #cbd5e1;
  border-radius: 14px;
  padding: 24px 18px;
  text-align: center;
  background: #f8fafc;
  color: #64748b;
}

.qc-dropzone svg {
  color: #94a3b8;
}

.qc-dropzone p {
  margin: 10px 0 14px;
  font-size: 13px;
  color: #475569;
}

.qc-dropzone-note {
  display: block;
  margin-top: 12px;
  font-size: 11.5px;
  color: #94a3b8;
}

.qc-upload-form label input[type="file"],
.qc-btn input[type="file"],
.qc-empty input[type="file"] {
  display: none;
}

.qc-active-file {
  background: #f8fafc;
  border: 1px solid var(--qc-line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 8px;
}

.qc-active-file-name {
  font-weight: 700;
  color: var(--qc-ink);
  word-break: break-word;
}

.qc-active-file-stats {
  margin-top: 4px;
  font-size: 12px;
  color: var(--qc-muted);
}

.qc-section {
  padding: 36px 44px;
  background: var(--qc-bg);
  border-bottom: 1px solid var(--qc-line);
}

.qc-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 20px;
}

.qc-section h2 {
  margin: 0 0 6px;
  font-size: 21px;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.qc-section-head p {
  margin: 0;
  color: var(--qc-muted);
  font-size: 13px;
  max-width: 720px;
}

.qc-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.qc-project-card {
  background: #fff;
  border: 1px solid var(--qc-line);
  border-radius: var(--qc-radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.qc-project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--qc-shadow);
}

.qc-project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.qc-kind {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #1d4ed8;
  background: #eff6ff;
  padding: 4px 9px;
  border-radius: 999px;
}

.qc-responses {
  font-size: 12px;
  font-weight: 600;
  color: var(--qc-green);
}

.qc-project-card h3 {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--qc-ink);
  min-height: 42px;
}

.qc-project-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.qc-project-foot code {
  font-size: 10.5px;
  color: #94a3b8;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qc-no-data {
  font-size: 11.5px;
  color: #94a3b8;
  background: #f8fafc;
  border: 1px solid var(--qc-line);
  border-radius: 8px;
  padding: 6px 10px;
  white-space: nowrap;
}

.qc-empty {
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: var(--qc-radius);
  padding: 42px 24px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 8px;
}

.qc-empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--qc-blue);
  background: #eff6ff;
  margin-bottom: 4px;
}

.qc-empty h3 {
  margin: 0;
  font-size: 17px;
}

.qc-empty p {
  margin: 0 0 12px;
  color: var(--qc-muted);
  max-width: 520px;
  line-height: 1.55;
}

.qc-capabilities {
  background: #fff;
}

.qc-cap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.qc-cap {
  border: 1px solid var(--qc-line);
  border-radius: 14px;
  padding: 16px;
  background: #fbfdff;
}

.qc-cap h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
}

.qc-cap p {
  margin: 0;
  color: var(--qc-muted);
  font-size: 12.5px;
  line-height: 1.55;
}

/* ---------- адаптивность ---------- */
@media (max-width: 980px) {
  .qc-hero {
    grid-template-columns: 1fr;
    padding: 32px 22px;
  }
  .qc-section {
    padding: 28px 22px;
  }
  .qc-section-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .qc-appbar {
    padding: 0 14px;
  }
  .qc-user,
  .qc-brand-text {
    display: none;
  }
  .qc-project-chip {
    max-width: 180px;
  }
  .menubar {
    top: var(--qc-appbar-offset, 60px);
    overflow-x: auto;
    white-space: nowrap;
  }
}

@media (max-width: 620px) {
  .qc-appbar-divider,
  .qc-module svg {
    display: none;
  }
  .qc-appbar-right .qc-appbar-link {
    padding: 6px 8px;
    font-size: 12px;
  }
  .qc-project-grid {
    grid-template-columns: 1fr;
  }
  .qc-meta-row {
    gap: 12px;
    flex-direction: column;
  }
}

/* Строка о загруженной базе и панель многоответных наборов на Data View:
   видны над таблицей, чтобы наборы не терялись среди сотен столбцов. */
.dataset-info {
  margin: 0 0 6px;
  color: #334155;
  font-size: 13px;
}
.dataset-info strong {
  color: #0f172a;
}
.mr-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 8px;
  padding: 7px 10px;
  background: #eef3ff;
  border: 1px solid #d8e2ff;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.4;
}
.mr-bar .mr-title {
  font-weight: 600;
  color: #1e3a8a;
}
.mr-bar .mr-set {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 1px 7px;
  background: #fff;
  border: 1px solid #dbe4ff;
  border-radius: 999px;
  white-space: nowrap;
}
.mr-bar .mr-name {
  font-weight: 600;
  color: #1d4ed8;
  text-decoration: none;
}
.mr-bar .mr-name:hover {
  text-decoration: underline;
}
.mr-bar .mr-meta {
  color: #64748b;
  font-size: 11px;
}
.mr-bar .mr-set a:not(.mr-name) {
  color: #475569;
  font-size: 11px;
}
.mr-bar .mr-edit {
  margin-left: auto;
  color: #1d4ed8;
}
.mr-bar .mr-auto {
  color: #1d4ed8;
}
.mr-bar .mr-auto::before {
  content: "＋";
  margin-right: 2px;
}
.mr-bar .mr-empty {
  color: #64748b;
  font-style: italic;
}

/* Правка подписей ответов MR-набора и предпросмотр автосоздания */
.mr-label-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
}
.mr-label-edit .mr-var {
  min-width: 70px;
  color: #475569;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
}
.mr-label-edit input {
  flex: 1 1 180px;
  min-width: 140px;
}
.mr-auto-table td {
  vertical-align: top;
}
.mr-auto-table .mr-auto-pairs {
  min-width: 320px;
}
.mr-auto-table .mode-dich,
.mr-auto-table .mode-cat {
  white-space: nowrap;
}
.mr-auto-table .mode-cat {
  margin-top: 4px;
}
.mr-auto-table .mr-existing {
  color: #b45309;
}
.mr-auto-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
}
.mr-auto-card {
  padding: 10px 12px 12px;
  background: #fff;
  border: 1px solid #d8e2ff;
  border-radius: 8px;
}
.mr-auto-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 16px;
  margin-bottom: 4px;
}
.mr-auto-head label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #475569;
  font-size: 11.5px;
}
.mr-auto-head label.mr-auto-include {
  flex-direction: row;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: #1e3a8a;
}
.mr-auto-head input,
.mr-auto-head select {
  max-width: 100%;
}
.mr-auto-card .mr-existing {
  color: #b45309;
  font-size: 11.5px;
  align-self: center;
}
.mr-auto-card .mr-auto-pairs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 3px 16px;
  margin-top: 8px;
}
.mr-auto-card .mr-label-edit {
  min-width: 0;
}
.mr-auto-card .mr-label-edit input {
  min-width: 0;
  width: 100%;
}
.mr-auto-rule {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 22px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #dbe4ff;
}
.mr-auto-rule .mode-dich,
.mr-auto-rule .mode-cat {
  white-space: normal;
}

/* Копирование меток значений */
.labels-copy-form .field select,
.labels-copy-form .field input[type="text"] {
  max-width: 100%;
}
.labels-preview {
  max-height: 240px;
  overflow: auto;
  padding: 6px 8px;
  background: #f8faff;
  border: 1px solid #dbe4ff;
  border-radius: 6px;
}
.labels-preview-row {
  display: grid;
  grid-template-columns: minmax(50px, max-content) 1fr;
  gap: 4px 10px;
  padding: 2px 0;
  border-bottom: 1px solid #eef2ff;
  font-size: 12.5px;
}
.labels-preview-row:last-child {
  border-bottom: 0;
}
.labels-preview-row .val-code {
  color: #475569;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.labels-copy-actions {
  margin-top: 10px;
}
.toolbar-link {
  display: inline-block;
  padding: 3px 8px;
  color: #1d4ed8;
}
