:root {
  /* Design\Guide\01_qms_colors.jpg */
  --qms-bg: #EDF0F5;
  --qms-white: #FFFFFF;
  --qms-border: #C8D1E3;
  --qms-placeholder: #A3AEC7;
  --qms-text: #2F3747;
  --qms-focus: #5E70AD;
  --qms-green: #5DB35D;
  --qms-green-hover: #40A847;
  --qms-red: #DB3312;
  --qms-hover-bg: #EDF0F5;

  /* Design\Dashboard\concept.jpg */
  --qms-navy: #394357;
  --qms-eyebrow: #A3AEC7;
  --qms-chart-purple: #6A7CB8;
  --qms-chart-light: #C8D1E3;
  --qms-chart-blue: #5EB2EB;
  --qms-chart-green: #6ABD6A;
  --qms-badge-red: #EB4626;
  --qms-tooltip-dark: #5F6573;

  /* dashboard (unchanged) */
  --bg: #f2f4f7;
  --card-bg: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* --- Login page (Design\Profile & login\01_qms_login) --- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--qms-bg);
  font-family: "Roboto", -apple-system, "Segoe UI", Arial, sans-serif;
  padding: 24px;
}

.login-card {
  position: relative;
  background: var(--qms-white);
  border-radius: 0;
  padding: 32px;
  width: 368px;
  max-width: 100%;
}

.login-title {
  font-family: "Roboto", sans-serif;
  font-weight: 300;
  font-size: 24px;
  line-height: 32px;
  color: var(--qms-text);
  margin: 0 0 24px;
}

/* language selector */
.lang-select {
  position: relative;
  margin-bottom: 20px;
}

.lang-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  font-size: 13px;
  line-height: 20px;
  color: var(--qms-text);
}

.flag {
  display: inline-flex;
  flex-direction: column;
  width: 18px;
  height: 12px;
  overflow: hidden;
  flex-shrink: 0;
}

.flag-ru span { display: block; flex: 1 1 auto; }
.flag-ru span:nth-child(1) { background: #FFFFFF; }
.flag-ru span:nth-child(2) { background: #0039A6; }
.flag-ru span:nth-child(3) { background: #D52B1E; }

.flag-uk {
  background:
    linear-gradient(135deg, transparent 46%, #fff 46%, #fff 54%, transparent 54%),
    linear-gradient(45deg, transparent 46%, #fff 46%, #fff 54%, transparent 54%),
    #00247D;
  position: relative;
}
.flag-uk::before, .flag-uk::after {
  content: "";
  position: absolute;
  background: #CF142B;
}
.flag-uk::before { top: 0; bottom: 0; left: 45%; width: 10%; background: #fff; }
.flag-uk::after { left: 0; right: 0; top: 40%; height: 20%; background: #fff; }

.lang-chevron { flex-shrink: 0; }

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  background: var(--qms-white);
  box-shadow: 0 4px 20px rgba(47, 55, 71, 0.18);
  padding: 6px 0;
  z-index: 20;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: none;
  padding: 10px 16px;
  cursor: pointer;
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  font-size: 13px;
  line-height: 20px;
  color: var(--qms-text);
  text-align: left;
}

.lang-option:hover { background: var(--qms-hover-bg); }
.lang-option .check-icon { margin-left: auto; }

.error-msg {
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 13px;
  line-height: 20px;
  color: var(--qms-red);
  margin: 0;
}

.error-msg:not(:empty) { margin-bottom: 12px; }

.input-wrap { margin-bottom: 8px; }
.input-wrap--password { margin-bottom: 20px; }

.input-wrap input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 12px;
  border: 1px solid var(--qms-border);
  background: var(--qms-white);
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  font-size: 13px;
  line-height: 20px;
  color: var(--qms-text);
}

.input-wrap input::placeholder { color: var(--qms-placeholder); }

.input-wrap input:focus {
  outline: none;
  border-color: var(--qms-focus);
}

.options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  font-size: 13px;
  line-height: 20px;
  color: var(--qms-text);
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.checkbox-box {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 1px solid var(--qms-border);
  background: var(--qms-white);
  position: relative;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-box::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid var(--qms-text);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-label input[type="checkbox"]:focus-visible + .checkbox-box {
  border-color: var(--qms-focus);
}

.restore-link {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 13px;
  line-height: 20px;
  color: var(--qms-text);
}

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

.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  border: none;
  background: var(--qms-green);
  color: #fff;
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
}

.btn-submit:hover { background: var(--qms-green-hover); }

@media (max-width: 420px) {
  .login-card { padding: 20px; }
  .login-title { font-size: 20px; line-height: 26px; margin-bottom: 16px; }
}

/* --- Dashboard (Design\Dashboard\concept.jpg, 01_qms_dashboard.png) --- */
.dash-body {
  margin: 0;
  background: var(--qms-bg);
  font-family: "Roboto", -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--qms-text);
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 24px;
  background: var(--qms-navy);
  position: relative;
}

.dash-header__left,
.dash-header__right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.icon-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
}

.dash-title {
  margin: 0;
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
}

.dash-configure {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: #B7BFCE;
}

.dash-configure:hover { color: #fff; }

.dash-link {
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: #B7BFCE;
  text-decoration: none;
}

.dash-link:hover { color: #fff; }

.notif-trigger {
  gap: 8px;
  font-family: "Roboto", sans-serif;
  font-size: 13px;
  color: #B7BFCE;
}

.notif-trigger:hover { color: #fff; }

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--qms-badge-red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.user-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: #fff;
}

.dropdown { position: relative; }

.dropdown-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 320px;
  background: var(--qms-white);
  box-shadow: 0 4px 20px rgba(47, 55, 71, 0.25);
  z-index: 30;
  text-align: left;
}

.notif-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--qms-hover-bg);
}

.notif-category {
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 11px;
  line-height: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--qms-eyebrow);
  margin-bottom: 4px;
}

.notif-text {
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  font-size: 13px;
  line-height: 18px;
  color: var(--qms-text);
  margin-bottom: 4px;
}

.notif-time {
  font-family: "Roboto", sans-serif;
  font-size: 12px;
  color: var(--qms-eyebrow);
}

.notif-viewall {
  display: block;
  width: calc(100% - 32px);
  margin: 16px;
  height: 40px;
  border: none;
  background: var(--qms-green);
  color: #fff;
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.notif-viewall:hover { background: var(--qms-green-hover); }

.user-panel { padding: 20px; width: 280px; }

.user-panel__title {
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  font-size: 12px;
  color: var(--qms-eyebrow);
  margin-bottom: 14px;
}

.user-info { margin: 0 0 16px; }

.user-info__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-family: "Roboto", sans-serif;
  font-size: 13px;
}

.user-info__row dt { color: var(--qms-eyebrow); margin: 0; }
.user-info__row dd { color: var(--qms-text); margin: 0; text-align: right; }

.user-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: none;
  padding: 12px 0 0;
  border-top: 1px solid var(--qms-hover-bg);
  width: 100%;
  cursor: pointer;
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: var(--qms-eyebrow);
}

.user-logout:hover { color: var(--qms-text); }

/* --- widget grid --- */
.dash-shell {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px;
}

.widgets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.widget {
  background: var(--qms-white);
  padding: 20px;
  min-width: 0;
}

.widget--span2 { grid-column: span 2; }

.widget-eyebrow {
  display: block;
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 11px;
  line-height: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--qms-eyebrow);
  margin-bottom: 16px;
}

.axis-label {
  font-family: "Roboto", sans-serif;
  font-size: 10px;
  fill: var(--qms-eyebrow);
}

.gridline { stroke: var(--qms-hover-bg); stroke-width: 1; }

/* widget 1 — combo chart */
.widget1-body {
  display: flex;
  align-items: center;
  gap: 16px;
}

.widget1-body .chart-combo { flex: 1 1 auto; min-width: 0; }

.kpi-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 0 0 100px;
}

.kpi-value {
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 32px;
  line-height: 1.1;
  color: var(--qms-text);
}

.kpi-caption {
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  font-size: 12px;
  line-height: 16px;
  color: var(--qms-eyebrow);
}

.bubble-num {
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 9px;
  fill: #fff;
  text-anchor: middle;
  dominant-baseline: central;
}

/* widget 2 — donut */
.widget2-body { display: flex; flex-direction: column; align-items: center; }
.donut-wrap { position: relative; width: 150px; height: 150px; }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.donut-value {
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 34px;
  color: var(--qms-text);
  line-height: 1;
}
.donut-sub {
  margin-top: 6px;
  text-align: center;
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--qms-text);
  line-height: 1.2;
}
.donut-sub-caption {
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  font-size: 11px;
  color: var(--qms-eyebrow);
}

/* widget 3 — stacked bars */
.stacked-bars {
  display: flex;
  align-items: flex-end;
  gap: 40px;
  height: 190px;
  padding-left: 28px;
  position: relative;
}

.stacked-bars .axis-lines {
  position: absolute;
  left: 28px;
  right: 0;
  top: 0;
  bottom: 0;
}

.bar-col { width: 56px; display: flex; flex-direction: column-reverse; position: relative; }
.bar-seg--light { background: var(--qms-chart-light); }
.bar-seg--main { background: var(--qms-chart-purple); }
.bar-seg--accent { background: var(--qms-chart-blue); }

.bar-tag {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--qms-tooltip-dark);
  color: #fff;
  font-family: "Roboto", sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  white-space: nowrap;
}

/* widget 4 — paired bars */
.legend-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.legend-pill {
  background: var(--qms-chart-purple);
  color: #fff;
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 5px 12px;
}
.legend-plain {
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  font-size: 12px;
  color: var(--qms-eyebrow);
}

.paired-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 160px;
  gap: 12px;
}
.pair-group { display: flex; align-items: flex-end; gap: 4px; flex: 1 1 0; position: relative; }
.pair-bar { flex: 1 1 0; }
.pair-bar--dark { background: var(--qms-chart-purple); }
.pair-bar--light { background: var(--qms-chart-light); }

/* widget 5 — quality bars */
.quality-chart { position: relative; padding-left: 32px; height: 190px; }
.quality-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  height: 100%;
}
.quality-bar { flex: 1 1 0; background: var(--qms-chart-purple); position: relative; }

.threshold-line {
  position: absolute;
  left: 32px;
  right: 0;
  border-top: 2px solid var(--qms-chart-green);
}
.threshold-label {
  position: absolute;
  left: 36px;
  transform: translateY(-50%);
  background: var(--qms-white);
  padding: 0 4px;
  font-family: "Roboto", sans-serif;
  font-weight: 700;
  font-size: 11px;
  color: var(--qms-chart-green);
}

.qtooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  white-space: nowrap;
}
.qtooltip-label {
  background: var(--qms-tooltip-dark);
  color: #fff;
  font-family: "Roboto", sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  margin-bottom: 2px;
}
.qtooltip-value {
  background: var(--qms-badge-red);
  color: #fff;
  font-family: "Roboto", sans-serif;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 12px;
}

@media (max-width: 820px) {
  .widgets-grid { grid-template-columns: repeat(2, 1fr); }
  .widget--span2 { grid-column: span 2; }
}

@media (max-width: 560px) {
  .widgets-grid { grid-template-columns: 1fr; }
  .widget--span2 { grid-column: span 1; }
  .dash-header__left { gap: 12px; }
  .dash-configure span,
  .dash-title { display: none; }
}
