* { box-sizing: border-box; }

:root {
  --navy: #101f3d;
  --navy-2: #172b52;
  --magenta: #e32182;
  --magenta-2: #ff5ca8;
  --rose: #c99286;
  --rose-soft: #f8ebe8;
  --gold: #d9bd82;
  --champagne: #f6efe2;
  --bg: #fbf7f5;
  --surface: #ffffff;
  --surface-2: #fffaf8;
  --border: #eadfda;
  --text: #243047;
  --muted: #6f7890;
  --danger: #b95a5a;
  --success: #497a68;
  --shadow: 0 18px 45px rgba(16, 31, 61, .08);
  --shadow-soft: 0 8px 22px rgba(16, 31, 61, .06);
}

html { font-size: 15px; }
body {
  margin: 0;
  background: radial-gradient(circle at top right, rgba(248, 235, 232, .8), transparent 360px), var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--navy-2); text-decoration: none; font-weight: 600; }
a:hover { color: var(--rose); }

.app-shell { display: grid; grid-template-columns: 284px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--navy), #0c1830);
  color: #fff;
  padding: 22px 16px;
  box-shadow: 14px 0 35px rgba(16, 31, 61, .12);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  margin-bottom: 18px;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--rose), var(--gold));
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 10px 24px rgba(217, 189, 130, .22);
}
.brand-logo {
  display: block;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  object-fit: contain;
  background: rgba(255, 255, 255, .95);
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .16);
}
.brand-text { display: grid; gap: 2px; }
.brand-text strong { font-size: 16px; line-height: 1.2; }
.brand-text small { color: #e9d9d0; font-size: 12px; }
.nav-section {
  margin: 20px 8px 7px;
  color: #c9b29d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.sidebar a {
  display: flex;
  align-items: center;
  min-height: 38px;
  color: #e8edf8;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.sidebar a:hover,
.sidebar a.active {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  transform: translateX(2px);
}
.sidebar a.active { box-shadow: inset 3px 0 0 var(--rose); }

.content { min-width: 0; }
.topbar {
  min-height: 76px;
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid rgba(234, 223, 218, .85);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 30px;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
}
.search-form { flex: 1; }
.search-form input {
  height: 44px;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  background: #fff;
}
.user-menu { display: flex; align-items: center; gap: 12px; white-space: nowrap; color: var(--muted); }
.user-menu > span {
  color: var(--navy);
  font-weight: 700;
  padding: 8px 10px;
  background: var(--champagne);
  border-radius: 999px;
}
.user-menu form { margin: 0; }

.messages, .page-header, .content > h1, .content > h2 { margin: 26px 30px 0; }
.page-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 30px -8px;
}
.page-back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--navy);
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  padding: 7px 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.page-back-button:hover,
.page-back-button:focus {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  transform: translateY(-1px);
}
.page-header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(26px, 3vw, 30px); line-height: 1.2; font-weight: 700; letter-spacing: 0; color: var(--navy); }
h2 { font-size: 21px; line-height: 1.25; font-weight: 700; color: var(--navy); margin-bottom: 16px; }
h3 { font-size: 15px; line-height: 1.3; font-weight: 700; color: var(--navy); margin-bottom: 10px; }

.dashboard, .table-panel, .form-panel, .detail-panel {
  margin: 24px 30px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.dashboard { background: transparent; border: 0; box-shadow: none; padding: 0; }
.dashboard-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.dashboard-heading p { color: var(--muted); margin-bottom: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 16px; }
.stat {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  min-height: 132px;
  box-shadow: var(--shadow-soft);
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--rose);
}
.stat span:not(.stat-icon) { display: block; color: var(--muted); font-size: 13px; font-weight: 700; margin-top: 14px; }
.stat strong { display: block; color: var(--navy); font-size: 28px; line-height: 1.1; margin-top: 8px; font-weight: 800; }
.stat-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--champagne);
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
}
.stat-green::before { background: var(--success); }
.stat-rose::before { background: var(--rose); }
.stat-gold::before { background: var(--gold); }
.stat-muted::before { background: #9aa4b8; }
.stat-danger::before { background: var(--danger); }

.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 18px; margin-top: 22px; }
.insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow-soft);
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #f1e8e4;
  padding: 10px 0;
}
.bar-row:last-child { border-bottom: 0; }
.bar-row span { color: var(--text); overflow-wrap: anywhere; }
.bar-row small { color: var(--muted); font-size: 12px; font-weight: 700; }
.bar-row strong {
  min-width: 34px;
  text-align: center;
  background: var(--rose-soft);
  color: var(--navy);
  border-radius: 999px;
  padding: 3px 10px;
}
.empty-state {
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 14px;
  margin: 0;
  font-size: 14px;
}

.reminder-grid { display: grid; grid-template-columns: repeat(4, minmax(190px, 1fr)); gap: 16px; }
.reminder-card {
  background: linear-gradient(180deg, #fff, var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}
.reminder-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.reminder-card p {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #f0e6e1;
  padding-top: 10px;
  margin-bottom: 10px;
}
.reminder-card p:last-child { margin-bottom: 0; }
.reminder-card p span { color: var(--muted); font-size: 13px; }
.dashboard-lower { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; margin: 0 30px 30px; }
.dashboard-lower .table-panel { margin: 0; }
.value-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 0;
  border-bottom: 1px solid #f0e6e1;
}
.value-row:last-child { border-bottom: 0; }
.value-row span { color: var(--muted); font-weight: 700; }
.value-row strong { color: var(--navy); font-size: 22px; }

.table-panel { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fbf4f1;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  text-align: left;
}
.table td {
  border-bottom: 1px solid #f1e8e4;
  padding: 13px 14px;
  vertical-align: middle;
}
.table-sm td, .table-sm th { padding: 10px 12px; }
.table tbody tr:hover { background: #fff8f6; }
.table tbody tr:last-child td { border-bottom: 0; }

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.status-badge.neutral { background: #eef2f8; color: var(--navy-2); }
.status-badge.warning { background: var(--champagne); color: #7b5b14; }
.status-badge.danger { background: #f8e6e6; color: var(--danger); }
.status-badge.info { background: #eaf1fb; color: var(--navy-2); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 9px 15px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 10px 24px rgba(16, 31, 61, .18); }
.btn-primary:hover { background: var(--navy-2); color: #fff; }
.btn-secondary { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success {
  background: #fff;
  border-color: var(--border);
  color: var(--navy);
}
.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-success:hover { background: var(--rose-soft); color: var(--navy); border-color: var(--rose); }
.btn-danger,
.btn-outline-danger { background: #fff; border-color: #efc7c7; color: var(--danger); }
.btn-danger:hover,
.btn-outline-danger:hover { background: #f8e6e6; color: var(--danger); }
.btn-sm { min-height: 32px; padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.w-100 { width: 100%; }
.text-start { text-align: left; justify-content: flex-start; }
.text-center { text-align: center; }

.form-panel { max-width: 980px; }
.form-panel p, .mb-3 { margin-bottom: 18px; }
.form-label, .form-panel label {
  display: block;
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 7px;
}
.form-control, .form-select, input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #daccc6;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 9px 12px;
  font: inherit;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
textarea { min-height: 112px; resize: vertical; }
.form-control:focus, .form-select:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(201, 146, 134, .18);
}
input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  accent-color: var(--rose);
  vertical-align: middle;
  margin-right: 6px;
}
.form-text { color: var(--muted); font-size: 13px; margin-top: 5px; }
.text-danger { color: var(--danger); }
.small { font-size: 12px; }

.alert {
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  background: var(--surface-2);
  color: var(--text);
}
.alert-danger { background: #f8e6e6; border-color: #efc7c7; color: var(--danger); }
.alert-warning { background: var(--champagne); border-color: #ead6a8; color: #77591c; }
.alert-success { background: #e9f2ed; border-color: #cbded4; color: var(--success); }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.me-3 { margin-right: 16px; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.align-middle { vertical-align: middle; }

.row { display: flex; flex-wrap: wrap; margin: -6px; }
.row > * { padding: 6px; width: 100%; }
.g-2 { margin: -6px; }
.g-2 > * { padding: 6px; }
.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-md-1 { flex: 0 0 8.333%; max-width: 8.333%; }
.col-md-2 { flex: 0 0 16.666%; max-width: 16.666%; }
.col-md-3 { flex: 0 0 25%; max-width: 25%; }
.col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-md-8 { flex: 0 0 66.666%; max-width: 66.666%; }

.img-fluid { max-width: 100%; height: auto; }
.detail-panel .table th { position: static; width: 16%; }
.label-sheet { background: #fff; width: 360px; padding: 22px; border: 1px solid var(--navy); margin: 24px; text-align: center; border-radius: 8px; box-shadow: var(--shadow); }
.label-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--navy);
  text-align: left;
}
.label-brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}
.label-brand strong,
.label-brand small { display: block; }
.label-brand small { color: var(--muted); font-size: 11px; }
.label-sheet p { margin-bottom: 6px; }
.label-scan-text { color: var(--muted); font-size: 12px; font-weight: 700; margin-top: 8px; }
.qr-label-print-page {
  min-height: 100vh;
  background: var(--bg);
}
.print-controls {
  margin: 24px auto;
  width: min(1180px, calc(100% - 32px));
  background: rgba(255, 255, 255, .97);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.label-print-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}
.label-print-heading h1 { margin-bottom: 4px; }
.label-print-heading p {
  color: var(--muted);
  font-weight: 650;
  margin-bottom: 0;
}
.label-settings-form {
  display: grid;
  gap: 16px;
}
.label-settings-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
}
.label-settings-grid label,
.label-field-options label {
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}
.label-settings-grid input,
.label-settings-grid select { margin-top: 5px; }
.label-field-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding-top: 4px;
}
.label-field-options input,
#select-all-assets,
input[name="asset_ids"] {
  accent-color: var(--navy);
}
.label-preview {
  display: grid;
  gap: 18px;
  justify-content: center;
  padding: 0 16px 28px;
}
.qr-label-page {
  width: var(--paper-width);
  min-height: var(--paper-height);
  background: #fff;
  padding: var(--page-margin-top) var(--page-margin-right) var(--page-margin-bottom) var(--page-margin-left);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  page-break-after: always;
  break-after: page;
}
.qr-label-page:last-child {
  page-break-after: auto;
  break-after: auto;
}
.qr-label-sheet {
  display: grid;
  grid-template-columns: repeat(var(--label-columns), var(--label-width));
  grid-auto-rows: var(--label-height);
  gap: var(--label-gap-row) var(--label-gap-column);
  align-content: start;
}
.asset-qr-label {
  width: var(--label-width);
  height: var(--label-height);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  break-inside: avoid;
  page-break-inside: avoid;
  border: 1px solid rgba(16, 31, 61, .58);
  border-radius: 5px;
  background: #fff;
  color: var(--navy);
  padding: 2mm;
  font-size: var(--label-font-size);
  line-height: 1.18;
}
.asset-qr-label-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--qr-size);
  gap: 2mm;
  min-height: 0;
}
.asset-qr-label-text {
  display: flex;
  flex-direction: column;
  gap: 1mm;
  min-width: 0;
  overflow: hidden;
}
.asset-qr-label-text span,
.asset-qr-label-text strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-qr-label-brand {
  display: flex;
  align-items: center;
  gap: 1.5mm;
  min-width: 0;
}
.asset-qr-label-brand img,
.asset-qr-label-brand > span {
  width: 6mm;
  height: 6mm;
  flex: 0 0 6mm;
}
.asset-qr-label-brand img { object-fit: contain; }
.asset-qr-label-brand > span {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--rose);
  border-radius: 3px;
  color: var(--navy);
  font-size: 6px;
  font-weight: 800;
}
.asset-qr-label-brand strong,
.asset-qr-label-brand small {
  display: block;
  line-height: 1.05;
  white-space: nowrap;
}
.asset-qr-label-brand small,
.asset-qr-scan-text { color: var(--muted); }
.asset-qr-code {
  color: var(--navy);
  font-weight: 900;
}
.asset-qr-image {
  width: var(--qr-size);
  height: var(--qr-size);
  object-fit: contain;
  align-self: start;
}
.asset-qr-scan-text {
  display: block;
  border-top: 1px solid rgba(227, 33, 130, .26);
  padding-top: 1mm;
  font-size: calc(var(--label-font-size) * .9);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.qr-panel p { color: var(--navy); font-weight: 800; margin: 10px 0 4px; }
.qr-panel small { display: block; color: var(--muted); overflow-wrap: anywhere; font-size: 12px; }

.login-page {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 10%, rgba(227, 33, 130, .34), transparent 300px),
    radial-gradient(circle at 88% 18%, rgba(255, 92, 168, .20), transparent 280px),
    linear-gradient(135deg, #07142c 0%, var(--navy) 44%, #172f5a 100%);
  padding: 32px 24px;
}
.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, .08), transparent 32%),
    radial-gradient(circle at 50% 110%, rgba(255, 255, 255, .08), transparent 360px);
  pointer-events: none;
}
.login-background-accent {
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
  opacity: .55;
  pointer-events: none;
}
.login-accent-one {
  width: 280px;
  height: 280px;
  right: -90px;
  top: 12%;
  background: linear-gradient(135deg, rgba(227, 33, 130, .38), rgba(255, 255, 255, .04));
}
.login-accent-two {
  width: 220px;
  height: 220px;
  left: -80px;
  bottom: 10%;
  border: 1px solid rgba(255, 92, 168, .28);
  background: rgba(255, 92, 168, .10);
}
.login-box {
  position: relative;
  z-index: 1;
  width: min(468px, calc(100vw - 32px));
  background: rgba(255, 255, 255, .98);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 8px;
  padding: 34px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .34);
}
.login-box::before {
  content: "";
  display: block;
  height: 4px;
  margin: -34px -34px 28px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, var(--magenta), var(--magenta-2), var(--gold));
}
.login-brand {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
  margin-bottom: 10px;
}
.login-logo,
.login-logo-fallback {
  width: 88px;
  height: 88px;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(16, 31, 61, .14);
}
.login-logo {
  display: block;
  object-fit: contain;
  background: #fff;
  border: 1px solid #f0d7e5;
  padding: 8px;
}
.login-logo-fallback {
  display: inline-grid;
  place-items: center;
  background: linear-gradient(135deg, var(--magenta), var(--magenta-2));
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
}
.login-brand-text h1 {
  font-size: clamp(28px, 5vw, 32px);
  line-height: 1.15;
  margin-bottom: 5px;
  color: var(--navy);
  font-weight: 700;
}
.login-brand-text p {
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 0;
}
.login-welcome {
  color: #66708a;
  font-size: 15px;
  text-align: center;
  margin: 18px 0 24px;
}
.login-box .alert {
  margin-bottom: 18px;
  border-color: rgba(227, 33, 130, .22);
  background: #fff0f6;
  color: #9f1d59;
}
.login-box .form-label {
  color: var(--navy);
  font-size: 15px;
  font-weight: 700;
}
.login-box input {
  min-height: 48px;
  border-color: #e0d8df;
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
  padding: 11px 14px;
}
.login-box input:focus {
  border-color: var(--magenta);
  box-shadow: 0 0 0 4px rgba(227, 33, 130, .14);
}
.login-box .btn-primary {
  min-height: 48px;
  border-color: var(--navy);
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}
.login-box .btn-primary:hover,
.login-box .btn-primary:focus {
  border-color: var(--magenta);
  background: linear-gradient(135deg, var(--navy-2), #203a6b);
  box-shadow: 0 14px 30px rgba(227, 33, 130, .22);
}
.app-footer {
  margin: 18px 30px 24px;
  padding: 18px 0 0;
  border-top: 1px solid rgba(234, 223, 218, .75);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.app-footer span {
  display: inline-block;
  margin: 0 4px;
}
.login-footer {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 3px;
  margin-top: 20px;
  color: rgba(255, 255, 255, .76);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
}
.footer-dev-credit {
  color: inherit;
  font-weight: 800;
}
.scroll-top-button {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 16px 38px rgba(16, 31, 61, .28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .18s ease, transform .18s ease, background .18s ease;
}
.scroll-top-button.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.scroll-top-button:hover,
.scroll-top-button:focus {
  background: var(--magenta);
}

.qr-scan-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background:
    radial-gradient(circle at 15% 10%, rgba(227, 33, 130, .20), transparent 300px),
    linear-gradient(135deg, #07142c 0%, var(--navy) 52%, #172f5a 100%);
  padding: 26px 18px;
}
.qr-public-tools {
  width: min(1040px, 100%);
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}
.qr-scan-card {
  width: min(1040px, 100%);
  background: rgba(255, 255, 255, .98);
  border: 1px solid rgba(255, 255, 255, .70);
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .30);
  overflow: hidden;
}
.qr-scan-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, #fff, #fff6fa);
}
.qr-scan-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border: 1px solid #f0d7e5;
  border-radius: 8px;
  padding: 5px;
  background: #fff;
}
.qr-scan-header h1 {
  font-size: 24px;
  margin-bottom: 2px;
}
.qr-scan-header p,
.qr-asset-hero p { color: var(--muted); margin-bottom: 0; }
.qr-asset-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 24px 22px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.qr-eyebrow {
  display: block;
  color: var(--magenta);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.qr-asset-hero h2 {
  font-size: 28px;
  margin-bottom: 4px;
}
.qr-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 22px;
}
.qr-info-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}
.qr-info-panel h3 { margin-top: 8px; }
.qr-info-panel h3:first-child { margin-top: 0; }
.qr-info-panel dl {
  display: grid;
  grid-template-columns: minmax(120px, .8fr) minmax(0, 1.2fr);
  gap: 9px 14px;
  margin: 0 0 18px;
}
.qr-info-panel dl:last-child { margin-bottom: 0; }
.qr-info-panel dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.qr-info-panel dd {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
  .reminder-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .label-settings-grid { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-radius: 0 0 22px 22px; }
  .topbar { position: static; flex-direction: column; height: auto; align-items: stretch; padding: 16px; }
  .user-menu { flex-wrap: wrap; }
  .messages, .page-header, .content > h1, .content > h2, .dashboard, .table-panel, .form-panel, .detail-panel { margin-left: 16px; margin-right: 16px; }
  .page-tools { margin-left: 16px; margin-right: 16px; }
  .app-footer { margin-left: 16px; margin-right: 16px; }
  .dashboard-lower { grid-template-columns: 1fr; margin-left: 16px; margin-right: 16px; }
  .chart-grid, .reminder-grid { grid-template-columns: 1fr; }
  .label-settings-grid { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .label-print-heading { flex-direction: column; }
  .qr-info-grid { grid-template-columns: 1fr; }
  .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-8 { flex: 0 0 100%; max-width: 100%; }
}

@media (max-width: 620px) {
  .stat-grid { grid-template-columns: 1fr; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; }
  .table th, .table td { padding: 10px; }
  .scroll-top-button { right: 14px; bottom: 14px; width: 42px; height: 42px; }
  .login-page { padding: 20px 16px; }
  .login-box { padding: 26px 22px; }
  .login-box::before { margin: -26px -22px 24px; }
  .login-logo, .login-logo-fallback { width: 76px; height: 76px; }
  .label-settings-grid { grid-template-columns: 1fr; }
  .qr-scan-header,
  .qr-asset-hero { flex-direction: column; align-items: flex-start; }
  .qr-info-panel dl { grid-template-columns: 1fr; gap: 3px; }
}

@media print {
  body { background: #fff; }
  .sidebar,
  .topbar,
  .messages,
  .app-footer,
  .print-controls,
  .page-tools,
  .page-back-button,
  .back-button,
  .no-print,
  .scroll-top-button {
    display: none !important;
  }
  .app-shell { display: block; }
  .label-sheet { margin: 0; box-shadow: none; }
  .label-sheet .btn { display: none; }
  .qr-label-print-page {
    background: #fff;
  }
  .label-preview {
    display: block;
    padding: 0;
  }
  .qr-label-page {
    width: var(--paper-width);
    min-height: var(--paper-height);
    border: 0;
    box-shadow: none;
    margin: 0;
  }
  .asset-qr-label {
    box-shadow: none;
  }
}
