:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #eef3f8;
  --ink: #111827;
  --muted: #5d6778;
  --line: #dbe3ec;
  --brand: #126b62;
  --brand-strong: #0c4d47;
  --accent: #c68b2c;
  --danger: #b42318;
  --warning: #b54708;
  --success: #047857;
  --shadow: 0 18px 50px rgba(18, 31, 48, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.login-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  isolation: isolate;
  background: #071b23 url("./assets/pomiary-elektryka-login.png") center / cover no-repeat;
}

.login-screen::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, rgba(4, 18, 25, 0.42) 0%, rgba(5, 20, 27, 0.14) 52%, rgba(4, 18, 25, 0.32) 100%);
  content: "";
}

.login-screen.is-hidden,
.app-shell.is-locked {
  display: none;
}

.login-card {
  position: relative;
  display: grid;
  width: min(100%, 440px);
  gap: 18px;
  padding: 28px;
  border: 1px solid rgba(224, 181, 64, 0.55);
  border-radius: 8px;
  background: rgba(251, 254, 255, 0.96);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.44);
}

.login-brand {
  color: var(--ink);
}

.login-brand .brand-mark {
  border: 1px solid #f3c44e;
  background: #0f6170;
  box-shadow: 0 0 0 5px rgba(225, 170, 42, 0.12);
}

.login-card .eyebrow {
  color: #9a6300;
}

.login-card .primary-button {
  background: #0f6170;
}

.login-card .primary-button:hover,
.login-card .primary-button:focus-visible {
  background: #0a4d5a;
}

.login-card h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0;
}

.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.login-button {
  justify-content: center;
}

.login-hint,
.login-feedback {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.login-feedback.danger {
  color: var(--danger);
}

.app-credit {
  position: fixed;
  z-index: 20;
  bottom: 16px;
  left: 16px;
  display: grid;
  gap: 3px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 2px solid #d7a92a;
  border-radius: 6px;
  background: #090b0e;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.44), 0 0 0 0 rgba(215, 169, 42, 0.3);
  color: #f4d36c;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.42;
  overflow: hidden;
  isolation: isolate;
  animation: credit-glow 2.4s ease-in-out infinite;
}

.app-credit::before {
  position: absolute;
  z-index: 0;
  top: -48px;
  left: -72px;
  width: 30px;
  height: calc(100% + 96px);
  background: rgba(232, 238, 244, 0.92);
  box-shadow: 0 0 22px 10px rgba(193, 204, 214, 0.78);
  content: "";
  opacity: 0;
  transform: rotate(18deg) translateX(-40px);
  animation: credit-shimmer 2.4s ease-in-out infinite;
}

.app-credit > * {
  position: relative;
  z-index: 1;
}

.app-credit span {
  color: #f8dc7b;
}

.app-credit a {
  width: fit-content;
  color: #d7a92a;
  text-decoration: none;
}

.app-credit-link {
  display: grid;
  gap: 3px;
  width: 100% !important;
  cursor: pointer;
}

.app-credit-link:focus-visible {
  outline: 2px solid #f8dc7b;
  outline-offset: 4px;
}

.app-credit a:hover,
.app-credit a:focus-visible {
  text-decoration: underline;
}

@keyframes credit-glow {
  0%,
  100% {
    border-color: #d7a92a;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.44), 0 0 0 0 rgba(215, 169, 42, 0.28);
  }

  50% {
    border-color: #ffe59a;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.54), 0 0 0 9px rgba(215, 169, 42, 0.2);
  }
}

@keyframes credit-shimmer {
  0%,
  18% {
    opacity: 0;
    transform: rotate(18deg) translateX(-40px);
  }

  32% {
    opacity: 0.95;
  }

  62% {
    opacity: 0.72;
  }

  78%,
  100% {
    opacity: 0;
    transform: rotate(18deg) translateX(390px);
  }
}

@media (min-width: 981px) {
  .app-shell:not(.is-locked) + .app-credit {
    bottom: 12px;
    left: 12px;
    max-width: 256px;
    padding: 12px;
    font-size: 0.76rem;
  }
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: #16232f;
  color: #f8fbff;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: #0f6170;
  color: #ffffff;
  font-weight: 800;
}

@media (max-width: 720px) {
  .login-screen {
    background-position: 64% center;
  }

  .login-screen::before {
    background: rgba(4, 18, 25, 0.48);
  }
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.sidebar-footer {
  color: #b8c4d2;
  font-size: 0.92rem;
}

.nav-list {
  display: grid;
  gap: 10px;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #d9e3ee;
  text-align: left;
}

.nav-button.is-active {
  background: #233445;
  border-color: #38546e;
  color: #ffffff;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 800;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: #2dd4bf;
}

.main {
  padding: 28px;
  overflow: auto;
}

.topbar,
.section-heading,
.panel-header,
.modal-header,
.toolbar,
.topbar-actions,
.modal-actions {
  display: flex;
  align-items: center;
}

.topbar,
.section-heading,
.panel-header,
.modal-header {
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin-bottom: 26px;
}

.topbar h1,
.section-heading h2,
.modal-header h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.section-heading h2,
.modal-header h2 {
  font-size: 1.45rem;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-actions,
.modal-actions {
  gap: 10px;
}

.current-user {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
}

.primary-button,
.ghost-button,
.small-button,
.danger-button,
.icon-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 750;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: var(--brand);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--brand-strong);
}

.ghost-button,
.small-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.ghost-button {
  padding: 0 14px;
}

.small-button {
  min-height: 38px;
  padding: 0 10px;
}

.danger-button {
  min-height: 38px;
  padding: 0 10px;
  background: #fff5f5;
  border-color: #f3b8b3;
  color: var(--danger);
}

.icon-button {
  width: 44px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 1.3rem;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.tutorial-layout {
  display: grid;
  grid-template-columns: minmax(230px, 0.42fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.tutorial-nav {
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef4f7;
}

.tutorial-topic-button {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  font-size: 0.86rem;
  font-weight: 800;
  text-align: left;
}

.tutorial-topic-button:hover,
.tutorial-topic-button:focus-visible {
  border-color: #8bb7c7;
  background: #ffffff;
  color: var(--brand-strong);
}

.tutorial-topic-button.is-active {
  border-color: #4f889c;
  background: #176b82;
  color: #ffffff;
}

.tutorial-content {
  min-height: 490px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.tutorial-content h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.35rem;
}

.tutorial-description {
  max-width: 780px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.tutorial-steps {
  display: grid;
  gap: 12px;
  max-width: 820px;
  margin: 24px 0 0;
  padding-left: 24px;
}

.tutorial-steps li {
  padding-left: 5px;
  color: #263646;
  line-height: 1.55;
}

.tutorial-steps li::marker {
  color: var(--brand);
  font-weight: 900;
}

.tutorial-note {
  max-width: 820px;
  margin-top: 26px;
  padding: 14px 16px;
  border-left: 4px solid #c68b2c;
  background: #fff8e8;
  color: #684900;
  font-weight: 750;
  line-height: 1.5;
}

.tutorial-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 26px;
}

@media (max-width: 980px) {
  .tutorial-layout {
    grid-template-columns: 1fr;
  }

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

  .tutorial-content {
    min-height: 0;
  }
}

.admin-power {
  padding: 8px 12px;
  border-radius: 999px;
  background: #e6f7f3;
  color: var(--brand-strong);
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.metric,
.data-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(20, 32, 46, 0.06);
}

.metric {
  padding: 18px;
}

.user-panel {
  margin: 18px 0;
}

.audit-panel {
  margin: 18px 0;
}

.version-update-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.metric span {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.toolbar {
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0;
}

.search-field,
.select-field,
.form-grid label,
.measurement-form label,
.permissions-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.search-field {
  flex: 1;
}

.select-field {
  min-width: 210px;
}

.select-field.compact {
  min-width: 260px;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.permissions-grid legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 850;
}

.permissions-grid label {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
}

.permissions-grid input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(18, 107, 98, 0.2);
  outline-offset: 2px;
}

.data-panel {
  overflow: hidden;
}

.panel-header {
  min-height: 62px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.panel-header > div:first-child > span {
  color: var(--muted);
  font-weight: 700;
}

.panel-header .primary-button {
  color: #ffffff;
  font-weight: 800;
}

.panel-header .primary-button span {
  color: inherit;
}

.measurement-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.sonel-connection {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 1 1 360px;
  min-height: 62px;
  max-width: 440px;
  padding: 6px 8px 6px 10px;
  border: 1px solid #d2dde6;
  border-radius: 8px;
  background: #ffffff;
  color: #34495a;
}

.sonel-connection-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  background: #97a8b6;
  box-shadow: 0 0 0 3px rgba(151, 168, 182, 0.15);
}

.sonel-connection-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.sonel-connection-copy strong,
.sonel-connection-copy small {
  overflow-wrap: anywhere;
  white-space: normal;
}

.sonel-connection-copy strong {
  color: #203746;
  font-size: 0.78rem;
  line-height: 1.25;
}

.sonel-connection-copy small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.25;
}

.sonel-connection .small-button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 8px;
  font-size: 0.72rem;
  white-space: nowrap;
}

.sonel-connection[data-state="connected"] {
  border-color: #86cba7;
  background: #f0fbf5;
}

.sonel-connection[data-state="connected"] .sonel-connection-dot {
  background: #16824f;
  box-shadow: 0 0 0 3px rgba(22, 130, 79, 0.16);
}

.scanner-connection[data-state="checking"] .sonel-connection-dot {
  animation: scanner-pulse 1.1s ease-in-out infinite;
}

@keyframes scanner-pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.72);
  }
}

.sonel-connection[data-state="attention"] {
  border-color: #e6c67c;
  background: #fff9e9;
}

.sonel-connection[data-state="attention"] .sonel-connection-dot {
  background: #b77900;
  box-shadow: 0 0 0 3px rgba(183, 121, 0, 0.16);
}

.sonel-import-button {
  min-height: 42px;
  white-space: nowrap;
}

.meter-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(112px, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.meter-button {
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.meter-button.is-selected {
  border-color: rgba(18, 107, 98, 0.22);
  background: #ffffff;
  color: var(--brand-strong);
  box-shadow: 0 4px 12px rgba(20, 32, 46, 0.08);
}

.meter-button[data-meter-id="meter1"] {
  color: #167447;
}

.meter-button[data-meter-id="meter2"] {
  color: #b92d2d;
}

.meter-button[data-meter-id="meter1"].is-selected {
  border-color: #167447;
  background: #167447;
  color: #ffffff;
}

.meter-button[data-meter-id="meter2"].is-selected {
  border-color: #c93535;
  background: #c93535;
  color: #ffffff;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  min-height: 56px;
}

.company-cell strong,
.company-cell span,
.database-cell strong,
.database-cell span {
  display: block;
}

.company-cell span,
.database-cell span {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 3px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 850;
}

.badge.active,
.badge.ready {
  background: #e7f7ef;
  color: var(--success);
}

.badge.setup,
.badge.pending {
  background: #fff4e5;
  color: var(--warning);
}

.badge.paused,
.badge.maintenance {
  background: #fff1f0;
  color: var(--danger);
}

.badge.muted {
  background: var(--surface-soft);
  color: var(--muted);
}

.meter-badge {
  display: inline-flex;
  min-width: 78px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: #e8f7ef;
  color: #167447;
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.meter-badge.meter2 {
  background: #ffecec;
  color: #b92d2d;
}

.empty-state {
  display: none;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong {
  color: var(--ink);
  margin-bottom: 5px;
}

.client-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.detail-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
  font-weight: 800;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.modal {
  width: min(760px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.measurement-database-modal {
  width: min(1480px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow-y: auto;
}

.scanned-measurement-modal {
  width: min(860px, calc(100vw - 28px));
}

.scanned-measurement-copy {
  margin: 2px 0 18px;
  color: var(--muted);
  font-weight: 700;
}

.scanned-measurement-details {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.scanned-measurement-details div {
  grid-template-columns: minmax(150px, 0.6fr) minmax(0, 1.4fr);
  padding: 11px 14px;
  background: #fbfdff;
}

.scanned-measurement-details div:nth-child(even) {
  background: #f2f8fb;
}

.measurement-database-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.measurement-database-toolbar strong,
.measurement-database-toolbar span {
  display: block;
}

.measurement-database-toolbar span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

.measurement-database-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.measurement-database-table {
  min-width: 2040px;
}

.measurement-database-table th {
  background: #176b82;
  color: #ffffff;
}

.measurement-database-table td {
  background: #ffffff;
}

.sonel-result-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 148px;
}

.sonel-results-modal {
  width: min(1080px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow-y: auto;
}

.measurement-history-modal {
  width: min(1320px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow-y: auto;
}

.esonel-preview-modal {
  width: min(1320px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow-y: auto;
}

.esonel-preview-copy {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 700;
}

.esonel-preview-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.esonel-preview-table {
  min-width: 1050px;
}

.esonel-preview-table th {
  background: #176b82;
  color: #ffffff;
}

.measurement-history-copy {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 700;
}

.measurement-history-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.measurement-history-table {
  min-width: 1120px;
}

.measurement-history-table th {
  background: #176b82;
  color: #ffffff;
}

.sonel-results-copy {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 700;
}

.sonel-results-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sonel-results-table {
  min-width: 870px;
}

.sonel-results-table th {
  background: #176b82;
  color: #ffffff;
}

.sonel-result-values {
  display: grid;
  gap: 5px;
  min-width: 280px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sonel-result-values li {
  display: grid;
  grid-template-columns: minmax(112px, 0.8fr) minmax(0, 1.2fr);
  gap: 8px;
  color: #415566;
  font-size: 0.82rem;
}

.sonel-result-values strong {
  color: var(--ink);
}

.measurement-database-table tbody tr:nth-child(even) td {
  background: #f6f9fc;
}

.measurement-database-row.is-expiring td {
  background: #fff5c9;
}

.measurement-database-row.is-expiring:nth-child(even) td {
  background: #ffefad;
}

.measurement-database-row.is-expired td {
  background: #ffe0de;
}

.measurement-database-row.is-expired:nth-child(even) td {
  background: #ffd1cd;
}

.selection-column {
  width: 52px;
  text-align: center;
}

.selection-column input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--brand);
}

.badge.expiring {
  background: #fff0b3;
  color: #865d00;
}

.badge.expired {
  background: #ffd9d5;
  color: #b42318;
}

.modal::backdrop {
  background: rgba(12, 22, 32, 0.52);
}

.modal-content {
  padding: 20px;
}

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

.measurement-panel {
  margin: 18px 0;
}

.measurements-view .measurement-panel {
  margin-top: 0;
}

.measurement-form {
  display: grid;
  grid-template-columns: minmax(230px, 1.35fr) minmax(140px, 0.75fr) repeat(2, minmax(160px, 1fr));
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.scan-field input,
.measurement-id,
.qr-code {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.scan-field input {
  border-color: #7bb8c8;
  box-shadow: inset 0 0 0 1px rgba(23, 107, 130, 0.14);
}

.measurement-form input[readonly] {
  background: #edf6fa;
  color: #0f5264;
  font-weight: 850;
}

.quick-values {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
}

.quick-value-button {
  max-width: 100%;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid #c8d8e4;
  border-radius: 999px;
  background: #ffffff;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-value-button:hover,
.quick-value-button:focus-visible {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.validity-control {
  display: grid;
  gap: 8px;
  align-self: stretch;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

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

.validity-button {
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid #b6ccd8;
  border-radius: 8px;
  background: #ffffff;
  color: #0f5264;
  font-weight: 850;
}

.validity-button.is-selected {
  border-color: var(--brand);
  background: #e6f7f3;
  color: var(--brand-strong);
  box-shadow: inset 0 0 0 1px rgba(18, 107, 98, 0.24);
}

.validity-control strong {
  min-height: 30px;
  color: var(--ink);
  font-size: 0.86rem;
}

.toggle-field {
  display: flex !important;
  align-items: center;
  align-self: end;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.toggle-field input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--brand);
}

.form-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  align-self: end;
}

.scan-feedback {
  min-height: 42px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 800;
}

.scan-feedback.success {
  background: #e7f7ef;
  color: var(--success);
}

.scan-feedback.warning {
  background: #fff4e5;
  color: var(--warning);
}

.scan-feedback.danger {
  background: #fff1f0;
  color: var(--danger);
}

.measurement-table-wrap {
  border-bottom: 1px solid var(--line);
}

.measurement-label-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fcff;
}

.measurement-label-actions label {
  display: grid;
  min-width: min(100%, 380px);
  gap: 6px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
}

.measurement-label-actions select {
  width: 100%;
  min-height: 42px;
}

.label-preview-modal .modal-content {
  width: min(100%, 620px);
}

.label-preview-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.label-preview-stage {
  display: grid;
  justify-content: center;
  min-height: 500px;
  padding: 24px;
  border: 1px solid var(--line);
  background: #e9eff4;
}

.print-label {
  display: grid;
  align-content: start;
  width: 24mm;
  min-height: 120mm;
  padding: 2.2mm 1.5mm;
  background: #ffffff;
  color: #000000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 2.7mm;
  line-height: 1.15;
  text-align: center;
}

.print-label__device {
  margin-top: 1.2mm;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.print-label__company {
  padding-bottom: 1mm;
  border-bottom: 0.25mm solid #000000;
  font-size: 2.9mm;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.print-label__line {
  width: 100%;
  margin: 1.4mm 0;
  border: 0;
  border-top: 0.25mm solid #000000;
}

.print-label__muted {
  margin-top: 1.2mm;
}

.print-label__result {
  margin-top: 1.3mm;
  font-weight: 800;
}

.print-label__user {
  margin-top: 0.5mm;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.print-label__status {
  font-size: 6mm;
  line-height: 1;
}

.print-label__source {
  margin-top: 0.7mm;
  font-size: 2.15mm;
  font-weight: 700;
}

.print-label__details {
  display: grid;
  gap: 0.5mm;
  margin-top: 1mm;
  font-size: 2.35mm;
  overflow-wrap: anywhere;
}

.print-label__qr {
  display: grid;
  place-items: center;
  margin-top: 2mm;
}

.print-label__qr img {
  display: block;
  width: 18mm;
  height: 18mm;
  image-rendering: pixelated;
}

.measurement-table {
  min-width: 1610px;
}

.measurement-table th {
  background: #176b82;
  color: #ffffff;
}

.measurement-table td {
  background: #f8fcff;
}

.measurement-table tbody tr:nth-child(even) td {
  background: #edf6fa;
}

.measurement-table tr.is-recent td {
  box-shadow: inset 0 0 0 999px rgba(18, 107, 98, 0.08);
}

.id-code {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 6px;
  background: #e8f3f6;
  color: #0f5264;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-weight: 850;
}

.qr-code {
  color: var(--ink);
  font-weight: 750;
  white-space: nowrap;
}

.validity-cell strong,
.validity-cell span {
  display: block;
}

.validity-cell span {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 3px;
  white-space: nowrap;
}

.client-measurements-panel {
  margin-top: 16px;
}

.client-measurement-table {
  min-width: 1130px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 14px 18px;
  }

  .nav-list {
    display: flex;
  }

  .sidebar-footer {
    display: none;
  }

  .metric-grid,
  .client-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 720px) {
  .tutorial-nav {
    grid-template-columns: 1fr;
  }

  .tutorial-content {
    padding: 20px;
  }

  .tutorial-actions {
    display: grid;
  }

  .measurement-label-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .measurement-label-actions label {
    min-width: 0;
  }

  .label-preview-stage {
    min-height: 430px;
    padding: 18px;
  }

  .app-credit {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
    font-size: 0.72rem;
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .section-heading,
  .toolbar,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .measurement-database-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .sonel-connection,
  .sonel-import-button {
    max-width: none;
    width: 100%;
  }

  .metric-grid,
  .client-layout,
  .measurement-form,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .validity-buttons {
    grid-template-columns: 1fr;
  }

  .detail-list div {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .select-field,
  .select-field.compact {
    min-width: 0;
  }

  .brand span {
    display: none;
  }
}
