*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

:root {
  --bg:       #f4f6f9;
  --card:     #ffffff;
  --primary:  #2563eb;
  --primary-h:#1d4ed8;
  --gray:     #6b7280;
  --gray-l:   #d1d5db;
  --danger:   #dc2626;
  --success:  #16a34a;
  --text:     #111827;
  --radius:   10px;
  --shadow:   0 4px 24px rgba(0,0,0,.08);
}

body {
  background: var(--bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 1rem;
}

/* ── Card ────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

/* ── Logo ────────────────────────────────────────────────────── */
.logo {
  width: 200px;
  height: 200px;
  object-fit: contain;
}

/* ── Form ────────────────────────────────────────────────────── */
form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  font-family: inherit;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--gray-l);
  border-radius: 7px;
  font-size: 1rem;
  transition: border-color .15s;
  outline: none;
  background: #fff;
  color: var(--text);
}

input:focus {
  border-color: var(--primary);
  background: #fefce8;
}

/* Override browser autofill yellow on non-focused inputs */
input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  box-shadow: 0 0 0 1000px #fff inset;
}
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fefce8 inset;
  box-shadow: 0 0 0 1000px #fefce8 inset;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  width: 100%;
  padding: .7rem;
  border: none;
  border-radius: 7px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled)  { background: var(--primary-h); }
.btn-primary:disabled              { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  background: var(--gray-l);
  color: var(--gray);
  font-size: .9rem;
}
.btn-secondary:hover:not(:disabled) { background: #b7bec9; }
.btn-secondary:disabled             { opacity: .5; cursor: not-allowed; }

.btn-danger {
  background: var(--danger, #dc2626);
  color: #fff;
}
.btn-danger:hover:not(:disabled)  { background: #b91c1c; }
.btn-danger:disabled              { opacity: .5; cursor: not-allowed; }

.btn-row {
  display: flex;
  gap: .6rem;
}
.btn-row .btn { width: auto; flex: 1; }

/* ── Checkbox ────────────────────────────────────────────────── */
.check-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  color: var(--gray);
  cursor: pointer;
  width: 100%;
}
.check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ── Link ────────────────────────────────────────────────────── */
.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: .9rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.link-btn:hover { color: var(--primary-h); }
.link-btn--danger       { color: var(--danger, #dc2626); }
.link-btn--danger:hover { color: #b91c1c; }
.link-btn--active {
  background: #ffffff;
  border-radius: 4px;
  padding: .15rem .4rem;
  text-decoration: none;
}
.link-btn--active:hover { color: var(--primary-h); }

/* ── Messages ────────────────────────────────────────────────── */
.msg {
  width: 100%;
  padding: .7rem .9rem;
  border-radius: 7px;
  font-size: .9rem;
  text-align: center;
  display: none;
}
.msg.error   { background: #fee2e2; color: var(--danger);  display: block; }
.msg.success { background: #dcfce7; color: var(--success); display: block; }
.msg.info    { background: #dbeafe; color: var(--primary);  display: block; }

/* ── Verification section ────────────────────────────────────── */
#verify-section {
  width: 100%;
  display: none;
  flex-direction: column;
  gap: .85rem;
}
#verify-section.visible { display: flex; }

/* ── Forgot-password section ─────────────────────────────────── */
#forgot-section {
  width: 100%;
  display: none;
  flex-direction: column;
  gap: .85rem;
}
#forgot-section.visible { display: flex; }

.link-sep {
  color: #9ca3af;
  font-size: .9rem;
  user-select: none;
}
.links-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

/* ── Dashboard ───────────────────────────────────────────────── */
.dash-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dash-header {
  background: #e0ecff;
  border-bottom: 1.5px solid #d5d9e2;
  padding: 1rem 1.25rem .9rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.dash-header-top {
  display: flex;
  align-items: center;
  gap: .9rem;
  min-width: 0;
}

.dash-logo-small {
  width: 68px;
  height: 68px;
  object-fit: contain;
  flex-shrink: 0;
}
.page-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.dash-welcome {
  flex: 1;
  min-width: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-welcome-email {
  color: var(--primary);
}

.dash-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .4rem;
}

.dash-action-sep {
  color: var(--gray-l);
  font-size: .85rem;
  user-select: none;
}

/* ── Small buttons (dashboard) ───────────────────────────────── */
.btn.btn-sm {
  padding: .32rem .7rem;
  font-size: .82rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s, border-color .15s;
  width: auto;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gray-l);
  color: var(--gray);
}
.btn-outline:hover        { background: #e5e7eb; border-color: #9ca3af; }
.btn-outline:disabled     { opacity: .5; cursor: not-allowed; }

.btn-sm.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-sm.btn-primary:hover:not(:disabled) { background: var(--primary-h); }
.btn-sm.btn-primary:disabled             { opacity: .5; cursor: not-allowed; }

/* Section toggle buttons — flex so arrow is always right-aligned */
#gen-qr-btn, #assoc-qr-btn, #manage-groups-btn, #scans-btn {
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  min-width: 190px;
  width: 100%;
}
#prov-qr-btn {
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  width: auto;
  flex-shrink: 0;
  margin-left: auto;
}
#gen-qr-btn.btn-section-open,
#assoc-qr-btn.btn-section-open,
#scans-btn.btn-section-open,
#prov-qr-btn.btn-section-open {
  background: #1e3a8a;
  box-shadow: inset 0 2px 5px rgba(0,0,0,.25);
}
#gen-qr-btn.btn-section-open:hover,
#assoc-qr-btn.btn-section-open:hover,
#scans-btn.btn-section-open:hover,
#prov-qr-btn.btn-section-open:hover {
  background: #1e40af;
}

/* ── Dashboard body ──────────────────────────────────────────── */
.dash-body {
  padding: 1.4rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
}

.dash-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
}

.dash-row label {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.qrbox-select {
  padding: .4rem .6rem;
  border: 1.5px solid var(--gray-l);
  border-radius: 7px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  cursor: pointer;
}
.qrbox-select:focus { border-color: var(--primary); }
.qrbox-select.select-default { background: #fefce8; }

/* ── QR code ─────────────────────────────────────────────────── */
.qr-wrapper { margin-top: .25rem; }

.qr-img {
  display: block;
  max-width: 180px;
  height: auto;
  image-rendering: pixelated; /* keep modules crisp, no antialiasing */
}

/* Provisioning QR is shown full-width up to the card width */
.qr-wrapper > .qr-img {
  max-width: min(320px, 100%);
}

/* ── Associated QR Codes list ────────────────────────────────── */
.qr-codes-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .5rem;
  border-radius: 8px;
}

.qr-code-item {
  padding: .55rem .8rem;
  border-radius: 7px;
}
.qr-code-item:nth-child(odd)  { background: #eaecf5; }
.qr-code-item:nth-child(even) { background: #e0ecff; }

.qr-code-item-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
}

.qr-code-item-code {
  font-family: 'Courier New', Courier, monospace;
  font-size: .8rem;
  font-weight: normal;
  color: #374151;
  letter-spacing: .04em;
  white-space: nowrap;
  flex-shrink: 0;
  background: #fff;
  padding: .05rem .25rem;
  border-radius: 3px;
}

.qr-code-item-custom {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: .8rem;
  font-weight: 600;
  color: #374151;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.qr-code-item-header-btns {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  gap: .3rem;
  align-items: center;
}

.qr-code-item-toggle {
  flex-shrink: 0;
  box-sizing: content-box;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  aspect-ratio: 1 / 1;
  border: 1.5px solid var(--gray-l);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font-size: .9rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.qr-code-item-toggle:hover { background: #e5e7eb; }
.qr-code-item-toggle[hidden] { display: none; }

.qr-code-item-expanded {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: .6rem;
}
.qr-code-item-expanded[hidden] { display: none; }

.qr-item-render-actions {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1.5rem;
}

.qr-code-item-render {
  flex-shrink: 0;
}

.qr-code-item-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .45rem;
  align-self: flex-start;
  padding-top: 0;
}

.qr-custom-input,
input.qr-custom-input {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: .8rem;
  font-weight: normal;
  color: var(--text);
  flex: 1;
  min-width: 0;
  width: auto;
  border: 1.5px solid var(--gray-l);
  border-radius: 7px;
  padding: .4rem .6rem;
  background: #fff;
  outline: none;
  transition: border-color .15s;
}

.qr-custom-input:focus {
  border-color: var(--primary);
  background: #fefce8;
}

.qr-edit-saved {
  font-size: .78rem;
  font-weight: 600;
  color: #16a34a;
  margin: -.1rem 0 0 0;
  padding: 0 .3rem;
}

/* ── Move row ─────────────────────────────────────────────────── */
.qr-move-field-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: .2rem;
}
.qr-move-select,
.qr-move-input { background: #fefce8; font-family: inherit; width: 100%; }
.qr-move-field-wrap .gen-field-error { margin-left: 0; }
.qr-move-row { margin-top: .5rem; }
.qr-move-row[hidden] { display: none; }

input.qr-custom-input.gen-qr-field:focus {
  background: #fefce8;
}

/* ── Modal ────────────────────────────────────────────────────── */
.qr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.qr-modal-overlay[hidden] { display: none; }
.qr-modal-box {
  background: #fff;
  border-radius: 10px;
  padding: 1.4rem 1.6rem 1.2rem;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.qr-modal-msg {
  font-size: .95rem;
  color: var(--text);
  line-height: 1.45;
  margin: 0;
}
.qr-modal-btns {
  display: flex;
  gap: .7rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.qr-codes-empty {
  margin: 0;
  font-size: .9rem;
  color: #6b7280;
  padding: .25rem .3rem;
}

.qr-codes-loading {
  animation: qr-pulse 1.2s ease-in-out infinite;
}

@keyframes qr-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .35; }
}

.qr-group-label {
  font-size: .9rem;
  font-weight: 600;
  color: #374151;
  padding: .5rem .3rem .2rem;
  border-bottom: 1px solid #e5e7eb;
  margin-top: .4rem;
}
.qr-group-label.qr-group-label--empty {
  color: #9ca3af;
  font-weight: 400;
  border-bottom-color: #f3f4f6;
  text-align: right;
}

.qr-date-header {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  padding: .6rem .3rem .25rem;
  border-bottom: 2px solid #d1d5db;
  margin-top: .6rem;
}

#manage-group-right-col {
  flex: 0 0 60%;
  max-width: 60%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

#manage-group-label,
#manage-group-x {
  align-self: flex-start;
  padding-top: .4rem;
}
#manage-groups-wrapper .dash-row { gap: .4rem; }

#manage-group-field-wrap .qrbox-select,
#manage-group-field-wrap .qr-custom-input {
  width: 100%;
  box-sizing: border-box;
}

.manage-group-actions {
  display: flex;
  gap: .45rem;
}

.manage-group-actions[hidden] { display: none; }
#manage-create-row[hidden]    { display: none; }

.assoc-filter-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .4rem;
  align-items: center;
  width: 60%;
  max-width: 60%;
}
.assoc-filter-grid .qrbox-select,
.assoc-filter-grid .qr-custom-input {
  width: 100%;
  box-sizing: border-box;
}
.assoc-filter-grid label[hidden],
.assoc-filter-grid input[hidden] { display: none; }
.manage-group-actions .btn    { width: auto; flex: 1; }
#manage-create-btn            { width: 100%; }

.dash-row-spacer {
  /* invisible element matching the width of a .dash-row label to align siblings with the dropdown */
  visibility: hidden;
  pointer-events: none;
}

.gen-qr-item {
  display: flex;
  flex-direction: column;
  gap: .9rem;
}

#gen-qr-form {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.gen-qr-row {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.gen-qr-row--top {
  align-items: flex-start;
}

.gen-qr-row--top .gen-qr-label {
  padding-top: .4rem;
}

.gen-qr-code-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
}

#gen-qr-code-display {
  font-family: 'Courier New', Courier, monospace;
  font-size: .9rem;
  font-weight: 700;
  color: #374151;
  margin-top: 0;
  margin-bottom: .5rem;
  width: 180px;
  background: #fff;
  text-align: center;
  padding: .2rem .3rem;
  box-sizing: border-box;
}

.gen-qr-label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  min-width: 4rem;
  flex-shrink: 0;
}

.gen-qr-field {
  width: 65%;
  flex-shrink: 0;
  flex-grow: 0;
  box-sizing: border-box;
}

/* Prevent .qr-custom-input's flex:1 from overriding the fixed width */
.qr-custom-input.gen-qr-field {
  flex: none;
  width: 65%;
}

.gen-qr-actions {
  display: flex;
  gap: .5rem;
  margin-top: .3rem;
  padding-left: calc(4rem + .65rem); /* label min-width + row gap */
}

.gen-qr-actions .btn {
  min-width: 5rem;
}

.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-success:disabled             { opacity: .5; cursor: not-allowed; }

.btn-danger  { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled)  { background: #b91c1c; }
.btn-danger:disabled              { opacity: .5; cursor: not-allowed; }

.gen-qr-success-msg {
  font-size: .65rem;
  padding: .5rem;
  line-height: 1.5;
}

.gen-send-x {
  flex-shrink: 0;
  min-width: 1.7rem;
  min-height: 1.7rem;
  padding: .2rem .4rem;
  background: #fee2e2;
  border: 1.5px solid var(--gray-l);
  border-radius: 5px;
  cursor: pointer;
  font-size: .8rem;
  line-height: 1;
  color: var(--text);
}
.gen-send-x:hover { background: #fecaca; border-color: #f87171; }

.dash-row-x-spacer {
  visibility: hidden;
  pointer-events: none;
}

.gen-qr-msg {
  margin-top: .5rem;
  font-size: .85rem;
  font-weight: 600;
}
.gen-qr-msg--ok    { color: var(--text); }
.gen-qr-msg--error { color: #c0392b; }

.gen-field-error {
  font-size: .65rem;
  font-weight: normal;
  color: #c0392b;
  margin: -.15rem 0 0 calc(4rem + .65rem);
}
.gen-field-success {
  font-size: .65rem;
  font-weight: normal;
  color: #16a34a;
  margin: -.15rem 0 0 calc(4rem + .65rem);
}
#manage-group-error { margin-left: 0; }

/* ── Misc ────────────────────────────────────────────────────── */
.divider {
  width: 100%;
  text-align: center;
  position: relative;
  color: var(--gray-l);
  font-size: .8rem;
}

/* ── Scans section ───────────────────────────────────────────── */
.scans-filters {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  padding: .5rem 0;
}
#scans-search[hidden] { display: none; }
#scans-export[hidden] { display: none; }

.scans-export-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.scans-export-label {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

#scans-export-btn {
  font-size: .85rem;
  padding: .3rem .6rem;
}

.scans-filter-heading {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
}

.scans-filter-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .4rem .4rem;
  align-items: center;
  width: 60%;
}

.scans-filter-grid label {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.scans-filter-grid .qrbox-select {
  font-size: .85rem;
  padding: .3rem .5rem;
}

#scans-custom-date-spacer:not(:empty),
#scans-custom-date-wrap[hidden] + span { display: none; }

#scans-custom-date-wrap {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .2rem 0;
}

.scans-date-row {
  display: flex;
  align-items: center;
  gap: .4rem;
}

#scans-date-to-row[hidden] { display: none; }

input.scans-date-input {
  font-size: .85rem;
  padding: .28rem .45rem;
  width: 100%;
  box-sizing: border-box;
  background: #fefce8;
}

.scans-multiday-row,
.gen-qr-scan-limit-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-top: .3rem;
  margin-bottom: .3rem;
}

.scans-multiday-label,
.scans-filter-grid label.scans-multiday-label,
.gen-scan-limit-label {
  font-size: .82rem;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.gen-scan-limit-cb-wrap {
  display: flex;
  align-items: center;
  gap: .4rem;
}
#gen-scan-limit-wrap { margin-bottom: .3rem; }
#gen-scan-limit-wrap[hidden] { display: none; }
.gen-scans-allowed-lbl {
  font-size: .82rem;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
.gen-scans-allowed-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  width: 65%;
  min-width: 0;
  flex-shrink: 0;
  box-sizing: border-box;
}
.gen-scans-allowed-input {
  min-width: calc(5ch + 1.2rem);
}
/* Override .qr-custom-input's flex:1 — grow to fill remaining space */
input.qr-custom-input.gen-scans-allowed-input {
  flex: 1;
  width: auto;
  min-width: calc(5ch + 1.2rem);
}
#gen-validity-wrap { margin-bottom: .3rem; }
#gen-validity-wrap[hidden] { display: none; }
.gen-validity-date-row { margin-bottom: .25rem; }

/* Scans pagination bar */
.scans-pagination-bar {
  padding: .4rem .2rem .5rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: .4rem;
}
.scans-too-many-warn {
  font-size: .8rem;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 4px;
  padding: .25rem .55rem;
  margin: 0 0 .4rem;
}
.scans-pagin-range {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .25rem;
}
.scans-page-links {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
}
.scans-page-lbl {
  font-size: .8rem;
  color: var(--text);
  font-weight: 400;
  margin-right: .1rem;
}
.scans-page-links a {
  font-size: .8rem;
  color: var(--primary, #2563eb);
  text-decoration: none;
  padding: .1rem .35rem;
  border-radius: 3px;
  border: 1px solid transparent;
}
.scans-page-links a:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.scans-page-links a.scans-page-current {
  font-weight: 700;
  color: var(--text);
  cursor: default;
  pointer-events: none;
}

/* Manage QR – Edit Lim rows */
.qr-lim-row { display: flex; flex-direction: column; gap: .3rem; padding: .4rem 0 .3rem; }
.qr-lim-row[hidden] { display: none; }
.qr-lim-scans-row, .qr-lim-date-row { display: flex; align-items: center; gap: .4rem; }
.qr-lim-lbl {
  font-size: .82rem;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
.qr-lim-date-lbl {
  font-size: .82rem;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  width: 4.5rem;
}
.qr-lim-performed-val {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--gray-l);
  border-radius: 7px;
  padding: .25rem .5rem;
  flex-shrink: 0;
}
.qr-recipient-row { min-width: 0; margin-bottom: .4rem; }
.qr-recipient-row .qr-lim-date-lbl { width: auto; }
.qr-recipient-val {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: .8rem;
  font-weight: 600;
  color: #374151;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
input.qr-custom-input.qr-recipient-input {
  flex: 1;
  width: auto;
  min-width: 0;
}
.qr-lim-reset-wrap {
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-shrink: 0;
  cursor: pointer;
  margin-left: .6rem;
}
.qr-lim-reset-wrap[hidden] { display: none; }
.qr-lim-reset-lbl {
  font-size: .82rem;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
}
input.qr-custom-input.qr-lim-scans-input {
  flex: 1;
  width: auto;
  min-width: calc(5ch + 1.2rem);
}
input.qr-custom-input.qr-lim-from-input,
input.qr-custom-input.qr-lim-until-input {
  flex: 1;
  width: auto;
  min-width: 0;
}
.gen-validity-date-inner {
  display: flex;
  align-items: center;
  gap: .4rem;
  width: 65%;
  flex-shrink: 0;
  box-sizing: border-box;
}
.gen-validity-lbl {
  font-size: .82rem;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  width: 2.5rem;
}
input.qr-custom-input.gen-validity-date-input {
  flex: 1;
  width: auto;
  min-width: 0;
}

#scans-custom-date-wrap[hidden] { display: none; }

#scans-apply-btn {
  font-size: .85rem;
  padding: .3rem .6rem;
}

.scan-item-row1 {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}

.scan-item-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.scan-item-ts {
  font-size: .8rem;
  font-weight: normal;
  color: #374151;
}

/* ── Change password panel ────────────────────────────────────────────────── */
.chpass-panel {
  border-radius: 4px;
  padding: .75rem;
}
.chpass-panel[hidden] { display: none; }
.chpass-inner {
  max-width: 22rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.chpass-inner .field { margin-bottom: 0; }
#chpass-fields {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: .35rem;
}
#chpass-fields[hidden] { display: none; }
.chpass-inner .btn-primary {
  width: 100%;
  margin-top: .1rem;
}
.chpass-msg {
  font-size: .9rem;
  margin: 0;
  padding: .7rem .9rem;
  border-radius: 7px;
  display: none;
}
.chpass-msg[hidden] { display: none; }
.chpass-msg.chpass-msg--error { display: block; background: #fee2e2; color: var(--danger, #dc2626); }
.chpass-msg.chpass-msg--ok    { display: block; background: #dcfce7; color: var(--success, #16a34a); }

/* ── Delete account panel ────────────────────────────────────── */
.delacc-panel .chpass-inner { gap: .8rem; }
.delacc-intro {
  font-size: .9rem;
  color: var(--gray);
  margin: 0;
}
.delacc-panel .delacc-main-btn { margin-top: .2rem; }
#delacc-confirm-box {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: .85rem 1rem;
}
#delacc-confirm-box[hidden] { display: none; }
.delacc-warning {
  font-size: .9rem;
  font-weight: 600;
  color: var(--danger, #dc2626);
  margin: 0;
}
.delacc-yesno {
  display: flex;
  gap: .6rem;
}
.delacc-yesno .btn { flex: 1; }

/* ── Site footer ─────────────────────────────────────────────── */
.site-footer {
  width: 100%;
  text-align: center;
  padding: 1.2rem 1rem 2rem;
  font-size: .8rem;
  color: var(--gray);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .5rem;
}
.site-footer a { color: var(--gray); text-decoration: underline; }
.site-footer a:hover { color: var(--primary); }
.site-footer-sep { user-select: none; }