:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  background: #f3f6fa;
  color: #202632;
  --blue: #4f749d;
  --navy: #1f2f63;
  --red: #d73025;
  --green: #2f8f52;
  --border: #dce3ec;
  --muted: #6d7582;
  --page: #f3f6fa;
  --panel: #ffffff;
}

* { box-sizing: border-box; }
html,
body { max-width: 100%; overflow-x: hidden; }
body { margin: 0; min-height: 100vh; background: var(--page); }
a { color: #2d6df6; text-decoration: none; font-weight: 650; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

.topbar {
  min-height: 64px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--blue);
  color: #fff;
  width: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  min-width: 132px;
  flex: 0 0 auto;
}

.brand-logo {
  width: 108px;
  height: 44px;
  object-fit: contain;
  display: block;
  background: transparent;
  mix-blend-mode: multiply;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  justify-content: center;
}

.topbar nav a,
.topbar .nav-link {
  color: rgba(255,255,255,.72);
  padding: 22px 8px;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.topbar nav a:hover,
.topbar .nav-link:hover { color: #fff; }

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.language-switch select {
  min-width: 106px;
  border: 0;
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
  color: #111827;
  font: inherit;
}

.language-switch-floating {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 30;
  background: var(--blue);
  box-shadow: 0 10px 24px rgba(27, 44, 71, .18);
}

.subbar {
  min-height: 46px;
  padding: 10px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: #d2d2d2;
  border-bottom: 1px solid #c8cdd5;
}

.subbar a {
  color: #111;
  font-size: 15px;
  font-weight: 650;
  padding: 4px 0;
  white-space: nowrap;
}

.subbar a:hover { color: #2d6df6; }

.subbar .language-switch {
  margin-left: auto;
  background: var(--blue);
  color: #fff;
}

.wrap {
  width: min(1760px, calc(100vw - 56px));
  margin: 34px auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 6px 22px rgba(27, 44, 71, .07);
}

.hero-panel {
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.panel-title h1,
.hero-panel h1,
h1 {
  margin: 0;
  color: #202632;
  font-size: 27px;
  line-height: 1.15;
  letter-spacing: 0;
}

.panel-title p,
.hero-panel p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
}

h2 { margin: 0 0 16px; letter-spacing: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
}

.metric-card {
  min-height: 136px;
  border-left: 7px solid #2d6df6;
}

.metric-card:nth-child(2) { border-left-color: var(--green); }
.metric-card:nth-child(3) { border-left-color: var(--red); }

.metric-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.metric, .pin {
  font-size: 34px;
  line-height: 1.1;
  margin: 12px 0 0;
  font-weight: 800;
  color: #111827;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
  margin-bottom: 18px;
}

.inline,
.actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.printer-form {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: center;
  gap: 8px;
}

.printer-form button {
  justify-self: start;
}

.scan-help {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.scan-help strong {
  color: var(--text);
}

.report-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.compact-title {
  margin-bottom: 8px;
}

.active-profile {
  background: #e9f8ef;
  border-color: #bfe5cd;
  color: #27613d;
}

.stack-form {
  display: grid;
  gap: 10px;
}

.ad-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 16px 14px;
}

.ad-form .actions {
  grid-column: 1 / -1;
}

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

.settings-form .actions,
.settings-note {
  grid-column: 1 / -1;
}

.settings-note {
  border: 1px solid #cfe0ff;
  border-left: 6px solid #2f73f6;
  border-radius: 10px;
  background: #f4f8ff;
  color: #334155;
  padding: 14px 16px;
  line-height: 1.45;
}

.installer-preview {
  display: grid;
  gap: 12px;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 10px;
}

.preview-grid div {
  border: 1px solid #dbe7fb;
  border-radius: 8px;
  background: #fff;
  padding: 11px 12px;
}

.preview-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.preview-grid strong {
  display: block;
  overflow-wrap: anywhere;
  color: #202632;
  font-size: 13px;
}

.warning-text {
  color: #a15c00;
  background: #fff7e6;
  border: 1px solid #ffd88a;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.check-line {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #202632;
  font-weight: 650;
}

.field {
  display: grid;
  gap: 7px;
  color: #202632;
  font-size: 13px;
  font-weight: 800;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.field .check-line {
  color: #202632;
  font-size: 13px;
  font-weight: 750;
}

.check-line input {
  width: 18px;
  min-width: 18px;
  height: 18px;
}

.table-actions {
  padding: 18px 26px;
}

.compact-panel {
  padding-block: 22px;
}

.org-grid {
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  margin-bottom: 28px;
}

input,
select,
button,
.button {
  height: 39px;
  min-width: 0;
  border-radius: 8px;
  border: 1px solid #cfd9e6;
  padding: 0 14px;
  font: inherit;
  font-size: 13px;
  background: #fff;
}

input { min-width: 0; }
select {
  min-width: 0;
  padding-right: 34px;
  cursor: pointer;
}

button,
.button {
  background: #2f73f6;
  color: #fff;
  border-color: #2f73f6;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 750;
  white-space: nowrap;
}

button:hover,
.button:hover { filter: brightness(.97); }

button:disabled {
  opacity: .48;
  cursor: not-allowed;
}

button.ghost {
  background: #fff3f3;
  color: #d14654;
  border-color: #efc7cc;
}

.ghost-link {
  background: #fff;
  color: #2f73f6;
  border-color: #c9d8ff;
}

button.success {
  background: #effaf3;
  color: #2d7d49;
  border-color: #bfe5cd;
}

.btn-red {
  background: #d94b50;
  border-color: #d94b50;
}

.card-table {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow-x: auto;
  overflow-y: visible;
  box-shadow: 0 6px 22px rgba(27, 44, 71, .06);
}

.table-title {
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.table-title h2 {
  margin: 0;
  color: #202632;
  font-size: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 15px 18px;
  border-bottom: 1px solid #e9edf3;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 800;
}

tbody tr:nth-child(even) { background: #f7f9fc; }
tbody tr:hover { background: #f1f5fb; }

.badge {
  background: #eaf3ff;
  color: #2663d8;
  border: 1px solid #c9ddff;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
  display: inline-flex;
  min-width: 92px;
  justify-content: center;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 36px;
}

.error { color: #b42338; }
.success-text { color: #2d7d49; font-weight: 750; margin: 0; }
.muted { color: var(--muted); font-size: 12px; margin-top: 6px; }
.assigned-printer { color: var(--muted); font-size: 14px; }
.assigned-printer strong { color: #202632; }

.device-strip {
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  box-shadow: 0 6px 22px rgba(27, 44, 71, .05);
}

.device-strip.status-ok,
.device-strip.status-warning,
.device-strip.status-bad {
  background: #fff;
  color: #202632;
}

.device-strip.status-ok { border-color: #cfe9d9; }
.device-strip.status-warning { border-color: #f2d078; }
.device-strip.status-bad { border-color: #efc7cc; }

.device-main {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.device-main div {
  display: grid;
  gap: 3px;
}

.device-main span {
  color: var(--muted);
  font-size: 12px;
}

.device-dot {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(47, 143, 82, .12);
}

.status-warning .device-dot { background: #d19017; box-shadow: 0 0 0 5px rgba(209, 144, 23, .14); }
.status-bad .device-dot { background: #d14654; box-shadow: 0 0 0 5px rgba(209, 70, 84, .13); }

.device-facts {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.device-facts .status-pill,
.status-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 750;
}

.release-supplies {
  display: grid;
  grid-template-columns: repeat(5, minmax(94px, 1fr));
  gap: 10px;
  flex: 1 1 560px;
}

.release-supply {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 5px 8px;
  min-width: 0;
}

.release-supply > span:first-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.release-supply strong {
  color: #384252;
  font-size: 12px;
}

.release-supply .supply-meter {
  grid-column: 1 / -1;
  min-width: 0;
}

.status-pill {
  min-width: 96px;
  justify-content: center;
  border: 1px solid transparent;
}

.status-ok { background: #e9f8ef; color: #27613d; border: 1px solid #bfe5cd; }
.status-warning { background: #fff7df; color: #805b09; border: 1px solid #f2d078; }
.status-bad { background: #fff0f1; color: #9b2430; border: 1px solid #efc7cc; }

.status-row-warning { background: #fffaf0; }
.status-row-bad { background: #fff5f6; }

.devices-watch {
  border-radius: 16px;
}

.devices-status-table {
  min-width: 1540px;
}

.devices-status-table th {
  background: var(--navy);
  white-space: nowrap;
}

.devices-status-table td {
  height: 66px;
  white-space: nowrap;
}

.devices-status-table .status-pill {
  min-width: 94px;
  padding-inline: 18px;
  font-size: 13px;
}

.supply-cell {
  min-width: 136px;
}

.supply-cell > span:first-child {
  display: block;
  margin-bottom: 6px;
  color: #384252;
  font-weight: 750;
  text-align: center;
}

.supplies-cell {
  min-width: 270px;
}

.supply-line {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) 92px 42px;
  align-items: center;
  gap: 9px;
  margin: 5px 0;
  font-size: 12px;
}

.supply-meter {
  height: 8px;
  border-radius: 999px;
  background: #e7edf5;
  overflow: hidden;
  display: block;
  min-width: 104px;
}

.supply-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.fill-ok { background: var(--green); }
.fill-warning { background: #d19017; }
.fill-bad { background: #d14654; }
.fill-unknown { background: #a8b2bf; }


.footer {
  display: none;
}

@media (max-width: 1280px) {
  .hero-panel {
    align-items: flex-start;
    flex-direction: column;
  }
  .printer-form {
    width: 100%;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }
  .settings-form {
    grid-template-columns: 1fr;
  }
  .printer-form button {
    justify-self: start;
  }
  .scan-help {
    grid-template-columns: 1fr;
  }
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 14% 8%, rgba(210, 229, 255, .62), transparent 8%),
    radial-gradient(circle at 58% 62%, rgba(77, 126, 203, .48), transparent 32%),
    linear-gradient(122deg, rgba(6, 12, 24, .97), rgba(17, 36, 70, .72) 48%, rgba(5, 9, 17, .98)),
    linear-gradient(135deg, #05080f 0%, #132b58 52%, #030509 100%);
  overflow: hidden;
}

.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(110deg, transparent 0 38%, rgba(157, 196, 255, .34) 38.2%, transparent 38.8%),
    linear-gradient(90deg, rgba(122,166,238,.18) 1px, transparent 1px),
    linear-gradient(rgba(122,166,238,.13) 1px, transparent 1px);
  background-size: 420px 260px, 92px 92px, 92px 92px;
  transform: perspective(800px) rotateX(58deg) scale(1.75);
  transform-origin: center bottom;
  opacity: .58;
}

.login-panel {
  width: min(900px, 92vw);
  min-height: 430px;
  background: #213260;
  color: #fff;
  border: 0;
  border-radius: 0;
  padding: 74px 90px;
  box-shadow: 0 18px 40px rgba(0,0,0,.38);
  position: relative;
  z-index: 1;
}

.login-panel h1 {
  color: #fff;
  text-align: center;
  font-size: 20px;
  margin-bottom: 28px;
}

.login-logo-band {
  width: 230px;
  margin: 0 auto 26px;
  padding: 0;
  background: transparent;
}

.login-logo {
  width: 178px;
  height: 60px;
  object-fit: contain;
  display: block;
  margin: 0 auto 24px;
  background: transparent;
}

.login-panel .stack {
  display: grid;
  gap: 24px;
}

.login-panel input {
  width: 100%;
  height: 58px;
  border-radius: 0;
  border: 0;
  background: #fffbc9;
  font-size: 20px;
}

.login-panel input[name="pin"] {
  font-size: 31px;
  text-align: center;
  letter-spacing: 0;
}

.login-panel button {
  width: 100%;
  height: 72px;
  border-radius: 0;
  background: var(--red);
  border-color: var(--red);
  font-size: 18px;
}

.narrow { width: min(460px, 100%); }
.stack { display: grid; gap: 14px; }

.qr-thumb {
  width: 92px;
  height: 92px;
  border: 1px solid var(--line);
  background: #fff;
}

.mobile-link {
  max-width: 360px;
  overflow-wrap: anywhere;
}

.print-sheet {
  background: #fff;
  display: grid;
  place-items: start;
  min-height: 100vh;
  padding: 18mm;
}

.qr-card {
  width: 45mm;
  height: 28mm;
  border: 1px solid #111827;
  color: #111827;
  display: grid;
  grid-template-columns: 18mm 1fr;
  grid-template-rows: auto 1fr auto auto;
  column-gap: 3mm;
  align-items: center;
  padding: 3mm;
  font-size: 7pt;
  line-height: 1.15;
  background: #fff;
}

.qr-card-title {
  grid-column: 1 / 3;
  font-weight: 800;
  font-size: 8pt;
  letter-spacing: 0;
}

.qr-card img {
  grid-row: 2 / 5;
  width: 18mm;
  height: 18mm;
}

.qr-card strong,
.qr-card span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.print-labels {
  margin: 0;
  background: #fff;
  color: #111827;
  page: qr-labels;
}

.qr-label-sheet {
  width: 210mm;
  min-height: 297mm;
  display: grid;
  grid-template-columns: repeat(3, 70mm);
  grid-auto-rows: 42mm;
  align-content: start;
  background: #fff;
}

.qr-label {
  width: 70mm;
  height: 42mm;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 26mm 1fr;
  align-items: center;
  column-gap: 3mm;
  padding: 4mm;
  overflow: hidden;
  break-inside: avoid;
  page-break-inside: avoid;
}

.qr-label img {
  width: 26mm;
  height: 26mm;
}

.qr-label-copy {
  min-width: 0;
  display: grid;
  gap: 1.2mm;
  font-size: 7.5pt;
  line-height: 1.15;
}

.qr-label-title {
  color: #1f2f66;
  font-size: 8pt;
  font-weight: 800;
}

.qr-label strong,
.qr-label span,
.qr-label small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.qr-label strong {
  font-size: 8pt;
}

.qr-label small {
  color: #4b5563;
}

@page qr-labels {
  size: A4 portrait;
  margin: 0;
}

@media print {
  body.print-sheet { padding: 0; }
  .qr-card { box-shadow: none; }
  body.print-labels { margin: 0; }
  .qr-label-sheet { margin: 0; }
}

@media (max-width: 900px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 14px 18px; }
  .topbar nav {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px 14px;
    width: 100%;
  }
  .topbar nav a,
  .topbar .nav-link { padding: 4px 0; }
  .top-actions { flex-wrap: wrap; }
  .subbar { gap: 10px 16px; padding: 10px 18px; }
  .toolbar,
  .hero-panel { align-items: stretch; flex-direction: column; }
  .device-strip { align-items: stretch; flex-direction: column; }
  .device-facts { justify-content: flex-start; }
  .release-supplies { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .inline,
  .actions { flex-wrap: wrap; }
  table { min-width: 760px; }
  .card-table { overflow-x: auto; }
  .wrap { width: min(100vw - 28px, 1760px); margin-top: 20px; }
}
