:root {
  --bg: #f7f9fc;
  --bg-soft: #eef3ff;
  --ink: #111827;
  --muted: #5d6780;
  --line: #d8deec;
  --card: #ffffff;
  --accent: #0f6fb6;
  --accent-soft: #e8f3fb;
  --ok: #eaf8ef;
  --warn: #fff6dc;
  --err: #fdeeee;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 420px at 10% -30%, #dce8ff 0%, transparent 52%),
    radial-gradient(900px 350px at 90% -20%, #e7f0ff 0%, transparent 55%),
    var(--bg);
  background-repeat: no-repeat;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 14px;
}

h1 { font-size: 24px; margin: 0; }
h2 { font-size: 18px; margin: 10px 0; }
h3 { font-size: 15px; margin: 8px 0; }
p { margin: 0; }

.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  font-size: 18px;
  line-height: 1;
  vertical-align: middle;
}

.wrap {
  max-width: 1160px;
  margin: 26px auto;
  padding: 0 16px 28px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 10px 2px 2px;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.link-reset {
  text-decoration: none;
}

.brand img {
  height: 34px;
  width: auto;
  display: block;
}

.brand-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .01em;
}

.brand-user {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-user-name {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.header-inline-action,
.header-inline-action:visited,
.logout-inline,
.logout-inline:visited {
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.header-inline-action:hover,
.logout-inline:hover { color: var(--accent); }

.header-inline-action .material-symbols-rounded,
.logout-inline .material-symbols-rounded { font-size: 16px; }

.plain-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  text-decoration: none;
  color: var(--muted);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.plain-icon-action .material-symbols-rounded {
  font-size: 20px;
}

.plain-icon-action:hover {
  color: var(--accent);
}

.plain-icon-action.active {
  color: var(--accent);
}

.plain-icon-action.primary {
  color: #0b4f81;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 8px 24px rgba(20, 33, 61, 0.08);
}

.card-auth {
  margin: 44px auto;
}

.card-auth-login { max-width: 460px; }
.card-auth-register { max-width: 540px; }
.card-auth-pending { max-width: 560px; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.top-with-gap {
  margin-bottom: 14px;
}

.top p { margin: 4px 0 0; color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
}

.btn.secondary {
  background: #ffffff;
  color: var(--accent);
  border-color: #b9d3e9;
}

.btn:hover { filter: brightness(0.98); }

.icon-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.machine-images-section {
  margin: 8px 0 16px;
}

.machine-images-head {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 10px;
}

.machine-image-upload-form {
  margin: 0;
}

.machine-images-input {
  display: none;
}

.machine-image-slider {
  max-width: 760px;
  margin: 0 auto;
}

.machine-image-track {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  min-height: 320px;
  overflow: hidden;
}

.machine-image-slide {
  display: none;
  width: 100%;
  height: 100%;
  position: relative;
}

.machine-image-slide.active {
  display: block;
}

.machine-image-slide img {
  width: 100%;
  height: 320px;
  object-fit: contain;
  display: block;
}

.machine-image-slide-add {
  min-height: 320px;
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.machine-image-slide-add.active {
  display: flex;
}

.machine-image-add-cta {
  border-style: dashed;
}

.machine-image-archive-form {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

.machine-image-archive-btn {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid #c8d6eb;
  background: #ffffff;
  color: #4a5675;
}

.machine-image-archive-btn:hover {
  color: #9b1c31;
  border-color: #e6b6c0;
  background: #fff4f6;
}

.machine-image-dots {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.machine-image-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  border: 1px solid #9fb0cf;
  background: #ffffff;
  padding: 0;
  cursor: pointer;
}

.machine-image-dot.active {
  background: #0f6fb6;
  border-color: #0f6fb6;
}

.machine-image-dot-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.machine-image-dot-add:hover {
  border-color: #86a8cb;
  background: #f5faff;
}

.machine-image-dot-add .material-symbols-rounded {
  font-size: 10px;
}

.machine-image-empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: #f9fbff;
}

.icon-btn {
  width: 74px;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #31405f;
  text-decoration: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 6px 5px;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: #b9d3e9;
  background: #f8fbff;
}

.icon-btn .material-symbols-rounded {
  font-size: 20px;
}

.icon-label {
  font-size: 10px;
  line-height: 1.1;
  color: #5f6880;
  text-align: center;
  letter-spacing: .01em;
}

.icon-btn.primary {
  border-color: #a8c3df;
  background: #edf5ff;
  color: #0b4f81;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 13px;
  outline: none;
  background: #ffffff;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  border-color: #92adf6;
  box-shadow: 0 0 0 3px rgba(15, 111, 182, 0.18);
}

input[type='checkbox'],
input[type='radio'] {
  width: auto;
  padding: 0;
}

.row { display: flex; gap: 8px; }

.form-max-760 {
  max-width: 760px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid-2-bottom {
  margin-bottom: 14px;
}

.form-group {
  margin-bottom: 10px;
}

.form-group.file-upload {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.form-label-row .form-label {
  margin-bottom: 0;
}

.label-with-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.info-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.info-tooltip__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid #9aa8c7;
  background: #f2f6ff;
  color: #445275;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
}

.info-tooltip__bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: min(320px, calc(100vw - 40px));
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #2f3d5f;
  background: #1f2942;
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  box-shadow: 0 8px 18px rgba(20, 33, 61, 0.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 30;
}

.info-tooltip__bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1f2942;
}

.info-tooltip:hover .info-tooltip__bubble,
.info-tooltip:focus-within .info-tooltip__bubble {
  opacity: 1;
  visibility: visible;
}

.msg-top {
  margin-top: 6px;
}

.form-help {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.muted-text {
  color: var(--muted);
}

.auth-subtitle {
  color: var(--muted);
  margin-top: -4px;
}

.msg {
  border-radius: 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  font-size: 13px;
}
.msg.msg-dismissible {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-right: 8px;
  overflow: hidden;
  max-height: 220px;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity .26s ease,
    transform .26s ease,
    max-height .26s ease,
    margin .26s ease,
    padding .26s ease,
    border-width .26s ease;
}

.msg.msg-dismissible.msg-dismissing {
  opacity: 0;
  transform: translateY(-6px);
  max-height: 0;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}

.msg-text {
  flex: 1 1 auto;
}

.msg-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  padding: 0 2px;
  margin: 0 0 0 auto;
  min-width: 22px;
  min-height: 22px;
  text-align: center;
  opacity: .68;
  border-radius: 4px;
  box-shadow: none;
}

.msg-close:hover {
  opacity: 1;
}

.msg-close:focus-visible {
  outline: 1px solid #7ca4c9;
  outline-offset: 1px;
}
.msg.error { background: var(--err); border-color: #f6cfd2; }
.msg.warning { background: var(--warn); border-color: #ffe8a8; }
.msg.success { background: var(--ok); border-color: #bfe7cd; }
.msg.info { background: var(--accent-soft); border-color: #c9d9ff; }

table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 10px 8px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }

.category-block { margin-bottom: 18px; }
.category-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.category-title { margin: 6px 0 10px; padding-bottom: 7px; border-bottom: 2px solid #c7ddec; }

.category-edit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 500;
}

.category-edit-toggle.active {
  background: var(--accent-soft);
  border-color: #b9d3e9;
  color: #0b4f81;
}

.param-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.param-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}

.param-card.param-present {
  border-color: #b9dfc8;
  background: linear-gradient(180deg, #f6fff9 0%, #eefbf3 100%);
}

.param-card.param-missing {
  border-color: #f2c4c8;
  background: linear-gradient(180deg, #fff8f8 0%, #fff0f1 100%);
}

.home-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 14px;
}

.home-tile {
  text-decoration: none;
  color: var(--ink);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}

.home-tile .material-symbols-rounded {
  font-size: 40px;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0b4f81;
  background: #edf5ff;
  border: 1px solid #cfe0f5;
}

.home-tile-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.home-tile-text {
  color: var(--muted);
  font-size: 13px;
  max-width: 210px;
  line-height: 1.35;
}

.home-tile:hover {
  transform: translateY(-2px);
  border-color: #b9d3e9;
  box-shadow: 0 12px 26px rgba(20, 33, 61, 0.12);
}

.home-tile-disabled {
  opacity: .75;
  cursor: not-allowed;
  pointer-events: none;
}

.machine-find-row {
  margin-top: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.machine-version-row {
  margin: 10px 0 14px;
  align-items: center;
}

.machine-find-select,
.machine-find-input {
  flex: 1 1 260px;
}

.machine-find-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #6b7795 50%),
    linear-gradient(135deg, #6b7795 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 1px),
    calc(100% - 11px) calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.param-name { font-weight: 600; margin-bottom: 6px; }
.param-empty { color: #7a859f; font-style: italic; }
.param-readonly { color: #1f2942; font-weight: 500; padding: 6px 0; }
.param-meta { font-size: 12px; color: #4a5675; margin-bottom: 6px; }
.param-comment {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: #3d4663;
}

.param-info { margin-top: 8px; font-size: 12px; }
.param-info summary { cursor: pointer; color: #0f6fb6; font-weight: 600; }

.edit-row { display: flex; align-items: center; gap: 8px; }
.edit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #4a5675;
}

.machine-types-table td,
.machine-types-table th {
  vertical-align: top;
}

.machine-type-name {
  font-weight: 600;
  color: #1f2942;
  width: 34%;
}

.machine-type-read {
  min-height: 20px;
  color: #2d3752;
  line-height: 1.35;
}

.machine-type-input.hidden {
  display: none;
}

.attribute-assigned-row td {
  background: #eefbf3;
}

.wizard-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 200;
}

.wizard-backdrop.hidden {
  display: none;
}

.wizard-modal {
  width: min(760px, 100%);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 22px 50px rgba(20, 33, 61, 0.2);
}

.wizard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 210;
}

.modal-card {
  width: min(760px, 100%);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 22px 50px rgba(20, 33, 61, 0.2);
}

.modal-large {
  width: min(1100px, 100%);
}

.modal-search-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.document-search-layout {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 12px;
}

.document-results {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #f9fbff;
}

.machine-document-results {
  max-height: 360px;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  padding: 10px;
  margin-bottom: 8px;
}

.result-card.active-preview {
  border-color: #8fb4de;
  background: #eef6ff;
  box-shadow: 0 0 0 2px rgba(15, 111, 182, 0.12);
}

.result-card:last-child {
  margin-bottom: 0;
}

.result-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.result-checkbox-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 600;
  color: #1f2942;
}

.result-checkbox-wrap input[type='checkbox'] {
  width: auto;
  margin-top: 2px;
}

.result-preview-btn {
  white-space: nowrap;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border: 1px solid #d3ddef;
  background: #f5f8ff;
  color: #335176;
}

.result-badge.pdf {
  border-color: #f1c6ca;
  background: #fff3f4;
  color: #8f1f2d;
}

.result-badge.web {
  border-color: #c9def2;
  background: #edf6ff;
  color: #0b4f81;
}

.result-badge.recommended {
  border-color: #c9e8d4;
  background: #eefaf2;
  color: #1f6a3a;
}

.result-domain {
  color: var(--muted);
  font-size: 12px;
}

.document-preview {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #ffffff;
  min-height: 420px;
}

.document-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

#preview-frame {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.image-preview-frame {
  width: 100%;
  min-height: 420px;
  max-height: 420px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.datasheet-preview {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.machine-documents-stack {
  margin-top: 8px;
}

.datasheet-preview summary {
  cursor: pointer;
  color: #0f6fb6;
  font-weight: 600;
}

.datasheet-preview-body {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.document-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.document-actions-spacer {
  flex: 1 1 auto;
}

.document-actions-row form {
  margin: 0;
}

.datasheet-preview-frame {
  width: 100%;
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.hidden { display: none; }

@media (max-width: 760px) {
  .top { flex-direction: column; align-items: flex-start; }
  .row { flex-direction: column; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .modal-search-controls { flex-direction: column; align-items: flex-start; }
  .document-search-layout { grid-template-columns: 1fr; }
  .document-results { max-height: 320px; }
  .btn { justify-content: center; }
  .icon-actions { width: 100%; }
  .brand { flex-direction: column; align-items: flex-start; }
  .brand-user { align-items: flex-start; }
}
