:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f7fb;
  color: #14213a;
  --navy: #13243e;
  --blue: #2864dc;
  --blue-soft: #edf4ff;
  --border: #dce4ef;
  --muted: #64718a;
  --surface: #ffffff;
  --shadow: 0 10px 30px rgba(27, 45, 75, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f4f7fb;
  line-height: 1.5;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(19, 36, 62, 0.98);
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(9, 22, 42, 0.14);
}

.header-inner,
.page-container {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.header-nav a,
.header-nav .link-button {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 10px;
  border-radius: 8px;
  color: #ffffff;
  text-decoration: none;
}

.header-nav a:hover,
.header-nav .link-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.user-chip {
  max-width: 180px;
  overflow: hidden;
  color: #dbe6f6;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell {
  display: block;
  width: 100%;
  min-height: calc(100vh - 68px);
  margin: 0 auto;
}

.app-main {
  min-width: 0;
}

.sidebar {
  position: fixed;
  top: 88px;
  bottom: 24px;
  left: 0;
  z-index: 90;
  width: 230px;
  margin: 0;
  padding: 18px 12px;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 16px 16px 0;
  background: #fff;
  box-shadow: 8px 10px 30px rgba(27, 45, 75, 0.12);
  transform: translateX(calc(-100% + 18px));
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.sidebar:hover,
.sidebar:focus-within {
  transform: translateX(0);
  box-shadow: 12px 12px 36px rgba(27, 45, 75, 0.18);
}

.sidebar-handle {
  position: absolute;
  top: 50%;
  right: 0;
  display: grid;
  width: 18px;
  height: 82px;
  place-items: center;
  border-radius: 9px 0 0 9px;
  background: #2864dc;
  color: #fff;
  transform: translateY(-50%);
  box-shadow: -2px 4px 12px rgba(23, 61, 128, 0.2);
}

.sidebar-handle span {
  font-size: 20px;
  transition: transform 180ms ease;
}

.sidebar:hover .sidebar-handle span,
.sidebar:focus-within .sidebar-handle span {
  transform: rotate(180deg);
}

.sidebar-content {
  width: 204px;
}

.sidebar-title {
  margin: 0 10px 10px;
  color: #8994a6;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: grid;
  gap: 5px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 11px;
  border-radius: 10px;
  color: #43516a;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.sidebar-nav a span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 7px;
  background: #eef2f7;
  color: #57677f;
}

.sidebar-nav a:hover {
  background: #f4f7fb;
  color: #183a6b;
}

.sidebar-nav a.is-active {
  background: #eaf2ff;
  color: #2259ad;
}

.sidebar-nav a.is-active span {
  background: #d5e5ff;
  color: #1f58b0;
}

.qr-scan-button { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 8px 14px; border: 1px solid rgba(255,255,255,.45); border-radius: 10px; background: #fff; color: #15243b; cursor: pointer; font: inherit; font-weight: 750; box-shadow: 0 5px 16px rgba(0,0,0,.12); }
.qr-scan-button:hover { background: #eaf0f8; }
.scanner-open { overflow: hidden; }
.qr-scanner-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; }
.qr-scanner-modal[hidden] { display: none; }
.qr-scanner-backdrop { position: absolute; inset: 0; background: rgba(8,17,31,.76); }
.qr-scanner-panel { position: relative; width: min(520px,100%); padding: 20px; border-radius: 16px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.32); }
.qr-scanner-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.qr-scanner-heading h2, .qr-scanner-heading p { margin: 0; }
.qr-scanner-heading p { margin-top: 5px; color: #566278; }
.qr-scanner-close { border: 0; background: transparent; color: #172033; cursor: pointer; font-size: 32px; line-height: 1; }
.qr-camera-frame { position: relative; overflow: hidden; aspect-ratio: 4/3; border-radius: 12px; background: #101827; }
.qr-camera-frame video { width: 100%; height: 100%; object-fit: cover; }
.qr-camera-guide { position: absolute; inset: 18%; border: 3px solid #fff; border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.18); }
.qr-scanner-status { margin: 14px 0 0; color: #34445e; text-align: center; }
.qr-scanner-status.is-error { color: #9f2020; font-weight: 700; }

.link-button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 8px;
}

.page-container {
  padding-block: 36px 56px;
}

.message-container {
  width: min(1080px, calc(100% - 32px));
  margin: 18px auto 0;
}

.app-message {
  padding: 12px 16px;
  border-radius: 8px;
  background: #eaf0f8;
  color: #273852;
}

.app-message-success {
  background: #e7f6ed;
  color: #176536;
}

.app-message-error {
  background: #fff0f0;
  color: #9f2020;
}

.page-heading {
  margin-bottom: 22px;
}

.page-heading h1 {
  margin: 4px 0 6px;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.page-heading p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  display: inline-block;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow-danger {
  color: #b02a37;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.control-card,
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.control-card {
  display: flex;
  min-height: 208px;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border-top: 4px solid #5375a9;
}

.control-card-ups { border-top-color: #2864dc; }
.control-card-jenerator { border-top-color: #f09b31; }
.control-card-chiller { border-top-color: #20a7b5; }

.control-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.control-card-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 11px;
  background: var(--blue-soft);
  color: #2459b8;
  font-weight: 900;
}

.control-card-jenerator .control-card-icon { background: #fff4e6; color: #a8610d; }
.control-card-chiller .control-card-icon { background: #e9f9fa; color: #147b86; }
.card-arrow { color: #8a96a9; font-size: 22px; transition: transform 160ms ease; }
.control-card-link:hover .card-arrow { transform: translateX(4px); }

.control-card-link {
  color: inherit;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.control-card-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(23, 32, 51, 0.1);
}

.control-card-link:focus-visible {
  outline: 3px solid #7aa7dc;
  outline-offset: 3px;
}

.control-card h2 {
  margin: 0 0 5px;
  font-size: 23px;
}

.control-card p {
  min-height: 0;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.card-link-label {
  color: #315781;
  font-size: 13px;
  font-weight: 750;
}

.status-label {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eaf0f8;
  color: #34445e;
  font-size: 13px;
  font-weight: 600;
}

.breadcrumb {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
}

.breadcrumb a {
  color: #1f5da8;
}

.info-panel {
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

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

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

.equipment-table th,
.equipment-table td {
  padding: 13px 12px;
  border-bottom: 1px solid #e6ebf2;
  text-align: left;
}

.equipment-table th {
  color: #66738a;
  background: #f8fafc;
  font-size: 12px;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.equipment-table tbody tr:hover {
  background: #fafcff;
}

.serial-number {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 7px;
  background: #f1f4f8;
  color: #41506a;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
}

.empty-state {
  margin: 0;
  padding: 18px;
  border-radius: 10px;
  background: #f3f6fa;
  color: var(--muted);
}

.empty-state-success {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #f0f8f4;
  color: #356b50;
}

.empty-state-success span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #dff1e7;
  font-weight: 900;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.page-actions form {
  margin: 0;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background: #1f5da8;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.action-button[aria-disabled="true"] {
  background: #9ba7b8;
  cursor: not-allowed;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid #bdc9d8;
  border-radius: 8px;
  background: #ffffff;
  color: #25354e;
  font-weight: 700;
  text-decoration: none;
}

.helper-text {
  margin: 10px 0 0;
  color: #566278;
  font-size: 14px;
}

.history-preview {
  margin-top: 20px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.problem-dashboard {
  display: grid;
  gap: 16px;
  margin-top: 34px;
}

.dashboard-heading h2,
.dashboard-heading p {
  margin-bottom: 0;
}

.dashboard-heading h2 {
  margin-top: 4px;
  font-size: 26px;
}

.dashboard-heading p {
  color: #566278;
  margin-top: 0.5rem;
}

.problem-panel {
  margin-top: 0;
  padding-top: 19px;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading-row h2 {
  margin: 0;
  font-size: 21px;
}

.section-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #5375a9;
  box-shadow: 0 0 0 5px #edf2f8;
}

.panel-dot-ups { background: #2864dc; }
.panel-dot-jenerator { background: #e68a1b; }
.panel-dot-chiller { background: #1494a2; }

.count-badge {
  padding: 3px 8px;
  border-radius: 999px;
  background: #f0f3f7;
  color: #68758a;
  font-size: 12px;
  font-weight: 700;
}

.section-link,
.record-link {
  color: #245ca8;
  font-weight: 650;
}

.section-link {
  font-size: 14px;
  text-decoration: none;
}

.section-link:hover,
.record-link:hover {
  text-decoration: underline;
}

.section-description {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.info-panel-heading {
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid #e6ebf2;
}

.compact-actions {
  margin-top: 0;
}

.comment-cell {
  color: #3c485e;
}

.history-comment-with-images {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 180px;
}

.history-thumbnails {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 6px;
}

.history-thumbnails a {
  display: block;
  width: 54px;
  height: 54px;
  overflow: hidden;
  border: 2px solid #e1e6ed;
  border-radius: 8px;
  background: #edf1f6;
}

.history-thumbnails img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-thumbnails a:hover,
.history-thumbnails a:focus-visible {
  border-color: #e3de00;
  outline: none;
}

.history-thumbnails-large a {
  width: 84px;
  height: 84px;
}

.visual-page {
  max-width: 1120px;
}

.visual-upload-panel,
.visual-archive {
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.visual-upload-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.65fr) minmax(0, 1.6fr);
  gap: 28px;
  align-items: start;
}

.visual-upload-copy h2,
.visual-archive h2 {
  margin: 0;
}

.visual-upload-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.visual-upload-form {
  display: grid;
  gap: 16px;
}

.visual-form-field label {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 700;
}

.visual-form-field input[type="file"],
.visual-form-field textarea {
  width: 100%;
  border: 1px solid #bdc7d5;
  border-radius: 10px;
  background: #fff;
  font: inherit;
}

.visual-form-field input[type="file"] {
  padding: 10px;
  background: #f8fafc;
}

.visual-form-field textarea {
  min-height: 105px;
  padding: 11px 12px;
  resize: vertical;
}

.visual-upload-form .action-button {
  justify-self: end;
}

.visual-archive {
  margin-top: 20px;
}

.visual-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.visual-card {
  overflow: hidden;
  border: 1px solid #dfe6ef;
  border-radius: 13px;
  background: #fff;
}

.visual-image-link {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #edf1f6;
}

.visual-image-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

.visual-image-link:hover img {
  transform: scale(1.025);
}

.visual-card-body {
  padding: 14px;
}

.visual-date,
.visual-owner {
  margin: 0;
  color: #778398;
  font-size: 12px;
  font-weight: 650;
}

.visual-location {
  margin: 8px 0 0;
  color: #3c485e;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.camera-capture-field {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-top: 16px;
}

.camera-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.camera-capture-button {
  cursor: pointer;
}

.camera-file-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.camera-preview {
  width: min(100%, 280px);
  max-height: 220px;
  object-fit: cover;
  border: 1px solid #d6dde7;
  border-radius: 12px;
  background: #edf1f6;
}

.visual-comment {
  margin: 8px 0 12px;
  color: #26344a;
  overflow-wrap: anywhere;
}

.record-count {
  color: #566278;
  font-weight: 600;
}

.filter-panel {
  margin-bottom: 28px;
}

.filter-panel h2 {
  margin-top: 0;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.filter-field label {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
}

.filter-field input,
.filter-field select {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #b8c0ce;
  border-radius: 8px;
  background: #ffffff;
  font: inherit;
}

.filter-actions {
  margin-top: 18px;
}

.qr-toolbar {
  margin: 0 0 24px;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.qr-card {
  padding: 22px;
  border: 1px solid #dfe4ec;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.06);
  text-align: center;
}

.qr-card h2 {
  margin: 0 0 6px;
  font-size: 28px;
}

.qr-card p {
  min-height: 42px;
  margin: 0 0 10px;
  color: #566278;
}

.qr-card img {
  display: block;
  width: min(100%, 300px);
  height: auto;
  margin: 0 auto 12px;
  image-rendering: pixelated;
}

.qr-address {
  margin-bottom: 16px;
  color: #566278;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.state-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.state-tabs a {
  padding: 9px 14px;
  border: 1px solid #b8c0ce;
  border-radius: 999px;
  background: #ffffff;
  color: #34445e;
  font-weight: 700;
  text-decoration: none;
}

.state-tabs a.is-active {
  border-color: #1f5da8;
  background: #1f5da8;
  color: #ffffff;
}

.active-badge,
.archive-badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.active-badge {
  background: #e7f6ed;
  color: #176536;
}

.archive-badge {
  background: #eceff4;
  color: #4c586b;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background: #a52222;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.archive-notice,
.correction-warning {
  margin-bottom: 22px;
}

.admin-record-actions {
  margin: 0 0 22px;
}

.audit-entry {
  padding: 18px 0;
  border-bottom: 1px solid #dfe4ec;
}

.audit-entry:first-child {
  padding-top: 8px;
}

.audit-entry:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.audit-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.audit-heading span {
  color: #566278;
  font-size: 14px;
}

.audit-entry p {
  margin: 12px 0 8px;
}

.audit-entry ul {
  margin: 8px 0 0;
  padding-left: 22px;
}

.result {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.result-suitable {
  background: #e7f6ed;
  color: #176536;
}

.result-unsuitable {
  background: #fff0f0;
  color: #9f2020;
}

.control-form-page {
  max-width: 900px;
}

.form-section {
  margin-bottom: 22px;
  padding: 24px;
  background: #ffffff;
  border: 1px solid #dfe4ec;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(23, 32, 51, 0.05);
}

.form-section h2 {
  margin: 0 0 6px;
}

.checklist-list {
  margin-top: 18px;
}

.checklist-item {
  margin: 0;
  padding: 18px 0;
  border: 0;
  border-bottom: 1px solid #dfe4ec;
}

.checklist-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.checklist-item legend {
  width: 100%;
  margin-bottom: 12px;
  font-weight: 600;
}

.item-number {
  color: #1f5da8;
}

.answer-options > div {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.answer-options label {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid #b8c0ce;
  border-radius: 8px;
  cursor: pointer;
}

.answer-options input {
  width: 18px;
  height: 18px;
  margin: 0 8px 0 0;
}

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

.temperature-field label {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
}

.temperature-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.temperature-input input,
.comment-field textarea {
  width: 100%;
  border: 1px solid #b8c0ce;
  border-radius: 8px;
  font: inherit;
}

.temperature-input input {
  min-height: 44px;
  padding: 9px 11px;
}

.comment-field {
  margin-top: 16px;
}

.comment-field textarea {
  min-height: 120px;
  padding: 12px;
  resize: vertical;
}

.field-has-error input,
.field-has-error textarea {
  border-color: #b22222;
}

.field-error,
.form-errors {
  margin-top: 8px;
  color: #9f2020;
  font-weight: 600;
}

.form-errors {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #fff0f0;
}

.submit-row {
  display: flex;
  justify-content: flex-end;
}

.detail-grid {
  display: grid;
  gap: 22px;
}

.record-summary {
  margin: 0;
}

.record-summary > div {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #dfe4ec;
}

.record-summary > div:last-child {
  border-bottom: 0;
}

.record-summary dt {
  color: #566278;
  font-weight: 600;
}

.record-summary dd {
  margin: 0;
}

.answer-history-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid #dfe4ec;
}

.answer-history-row:last-child {
  border-bottom: 0;
}

.login-wrap {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
}

.login-card h1 {
  margin-top: 0;
}

.form-row {
  margin-bottom: 18px;
}

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

.form-row input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #b8c0ce;
  border-radius: 8px;
  font: inherit;
}

.primary-button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: #1f5da8;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.error-list {
  margin: 0 0 16px;
  padding: 12px 16px 12px 32px;
  background: #fff0f0;
  color: #9f2020;
  border-radius: 8px;
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    min-height: auto;
  }

  .sidebar {
    position: static;
    width: auto;
    margin: 12px 12px 0;
    padding: 10px;
    border-left: 1px solid var(--border);
    border-radius: 14px;
    overflow-x: auto;
    box-shadow: var(--shadow);
    transform: none;
  }

  .sidebar:hover,
  .sidebar:focus-within {
    transform: none;
    box-shadow: var(--shadow);
  }

  .sidebar-handle { display: none; }
  .sidebar-content { width: auto; }

  .sidebar-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .sidebar-nav {
    display: flex;
    width: max-content;
    min-width: 100%;
  }

  .sidebar-nav a {
    white-space: nowrap;
  }

  .header-inner,
  .page-container,
  .message-container {
    width: min(100% - 24px, 1180px);
  }

  .page-container {
    padding-block: 24px 40px;
  }

  .control-grid,
  .temperature-grid,
  .filter-grid,
  .qr-grid {
    grid-template-columns: 1fr;
  }

  .header-inner {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    padding-block: 10px;
  }

  .user-area {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding-top: 9px;
    border-top: 1px solid rgba(255, 255, 255, 0.13);
  }

  .qr-scan-button { order: -2; }

  .user-chip {
    order: -1;
    margin-left: auto;
    font-size: 12px;
  }

  .header-nav {
    width: 100%;
    padding: 7px 0 0;
    border: 0;
    overflow-x: auto;
  }

  .header-nav a,
  .header-nav .link-button {
    white-space: nowrap;
  }

  .control-card { min-height: 174px; }
  .page-heading h1 { font-size: 30px; }

  .info-panel,
  .history-preview {
    padding: 18px;
  }

  .compact-actions { width: 100%; }
  .compact-actions .secondary-button { flex: 1 1 auto; }

  .visual-upload-panel {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .visual-upload-form .action-button {
    width: 100%;
  }

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

  .audit-heading,
  .section-heading-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .record-summary > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .answer-history-row {
    flex-direction: column;
    gap: 8px;
  }

  .section-title-group { flex-wrap: wrap; }
  .equipment-table-wrap { overflow: visible; }

  .equipment-table,
  .equipment-table tbody,
  .equipment-table tr,
  .equipment-table td {
    display: block;
    width: 100%;
  }

  .equipment-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .equipment-table tbody {
    display: grid;
    gap: 10px;
  }

  .equipment-table tr {
    overflow: hidden;
    border: 1px solid #e0e7f0;
    border-radius: 11px;
    background: #fff;
  }

  .equipment-table td {
    display: grid;
    grid-template-columns: minmax(105px, 38%) minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #edf0f5;
    overflow-wrap: anywhere;
  }

  .equipment-table td:last-child { border-bottom: 0; }

  .equipment-table td::before {
    content: attr(data-label);
    color: #6b778c;
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
  }
}

@media (max-width: 430px) {
  .brand > span:last-child { font-size: 14px; }
  .user-chip { max-width: 140px; }
  .qr-scan-button { padding-inline: 11px; }

  .equipment-table td {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .visual-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  body {
    background: #ffffff;
  }

  .site-header,
  .print-hidden {
    display: none !important;
  }

  .qr-page {
    width: 100%;
    padding: 0;
  }

  .qr-page .page-heading {
    margin-bottom: 12px;
    text-align: center;
  }

  .qr-page .page-heading h1 {
    font-size: 24px;
  }

  .qr-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8mm;
  }

  .qr-card {
    padding: 5mm;
    border: 2px solid #172033;
    box-shadow: none;
    break-inside: avoid;
  }

  .qr-card h2 {
    font-size: 22px;
  }

  .qr-card p {
    min-height: 0;
    font-size: 12px;
  }

  .qr-address {
    margin-bottom: 0;
    font-size: 9px;
  }
}

.expected-answer { color: #2563eb; font-weight: 700; display: inline-block; margin-left: .5rem; }
