*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --color-bg: #f5f7fb;
  --color-surface: #fff;
  --color-text: #1a1a2e;
  --color-muted: #64748b;
  --color-border: #e5e7eb;
  --color-primary: #2563eb;
  --color-primary-soft: #eff6ff;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --touch-min: 2.75rem;
  --container-narrow: 420px;
  --container-default: 720px;
  --container-wide: 1120px;
  --container-backoffice: 1120px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-nav: 0 1px 2px rgba(15, 23, 42, 0.04);
  --bp-tablet: 640px;
  --bp-desktop: 1024px;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: #2563eb;
}

.site-header,
.site-footer {
  padding: 0.85rem 1.5rem;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-nav);
}

.site-footer {
  border-top: 1px solid #e5e7eb;
  border-bottom: none;
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
}

.logo {
  font-weight: 700;
  text-decoration: none;
  color: #1a1a2e;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.95rem;
}

.header-nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-nav a {
  text-decoration: none;
}

.header-nav a:hover {
  text-decoration: underline;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-left: 0.85rem;
  border-left: 1px solid var(--color-border);
}

.header-user-email {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  color: var(--color-muted);
}

.header-user-role {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.header-logout-btn {
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.3;
}

.header-logout-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.cashier-session {
  margin: 0.25rem 0 0;
  font-size: 0.92rem;
}

.cashier-session strong {
  color: var(--color-text);
  font-weight: 600;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
}

.container.narrow {
  max-width: 420px;
}

.container.center {
  text-align: center;
  padding-top: 4rem;
}

.lead {
  color: #64748b;
}

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

.card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.form {
  display: grid;
  gap: 1rem;
}

.form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.form input,
.form select {
  padding: 0.6rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
}

.checkbox {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
}

.btn {
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}

.btn-secondary {
  background: #e2e8f0;
  color: #1a1a2e;
}

.btn:disabled,
.btn.btn-disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

.cashier-code {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-align: center;
  padding: 1rem;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.15);
}

.code-section {
  margin: 1.5rem 0;
}

.label {
  text-align: center;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.hint {
  text-align: center;
  color: #64748b;
  font-size: 0.9rem;
}

.timer-bar {
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  margin-top: 1rem;
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  background: #2563eb;
  width: 100%;
  transition: width 1s linear;
}

.info-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

.info-card {
  background: #fff;
  border-radius: 12px;
  padding: 1rem;
  display: grid;
  gap: 0.25rem;
}

.info-label {
  font-size: 0.85rem;
  color: #64748b;
}

.info-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.consent-banner {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: grid;
  gap: 0.75rem;
}

.muted {
  color: #64748b;
}

.error {
  color: #dc2626;
}

.result {
  color: #16a34a;
}

.hidden {
  display: none;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.data-table th,
.data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 0.9rem;
}

.referral-url {
  word-break: break-all;
  background: #fff;
  padding: 0.75rem;
  border-radius: 8px;
}

.recent-clients {
  margin-bottom: 1.5rem;
}

.notice {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: #78350f;
}

.recent-clients h2 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.session-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.session-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border: 2px solid #2563eb;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  min-width: 4.5rem;
}

.session-chip:hover {
  background: #eff6ff;
}

.session-chip-code {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.session-chip-meta {
  font-size: 0.75rem;
  color: #64748b;
}

#redeem-wrap {
  margin: 0.5rem 0 1rem;
  padding: 0.75rem 1rem;
  background: #eff6ff;
  border: 2px solid #2563eb;
  border-radius: 8px;
}

#redeem-wrap label {
  display: block;
  margin-bottom: 0.35rem;
}

#redeem-wrap input {
  flex: 1;
  min-width: 0;
  margin-top: 0.25rem;
}

.redeem-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.redeem-row .btn-sm {
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
  white-space: nowrap;
  margin-bottom: 0.05rem;
}

.accrual-or {
  margin: 0.35rem 0;
  text-align: center;
  font-size: 0.9rem;
}

.accrual-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin: 0.75rem 0 1rem;
}

.accrual-section h3.accrual-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.accrual-mode {
  display: flex;
  gap: 0.35rem;
  margin: 0.65rem 0;
  flex-wrap: wrap;
}

.accrual-mode-btn {
  flex: 1;
  min-width: 5rem;
  text-align: center;
  padding: 0.45rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

.accrual-mode-btn:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}

.accrual-mode-btn input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.preview-row-accent strong {
  color: #059669;
}

#preview-error {
  margin: 0.5rem 0;
}

#redeem-wrap input[readonly] {
  background: #f1f5f9;
  color: #64748b;
}

.client-preview {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0 1rem;
}

.client-preview .preview-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.35rem 0;
}

.client-preview .preview-row strong {
  color: #0f172a;
}

.client-preview .preview-row.muted {
  font-size: 0.9rem;
  color: #64748b;
  border-top: 1px solid #e2e8f0;
  margin-top: 0.25rem;
  padding-top: 0.5rem;
}

.place-item .btn-row {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.tx-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.95rem;
}

.tx-table th,
.tx-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.tx-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
}

.tx-table tr:hover td {
  background: #f8fafc;
}

.tx-list {
  overflow-x: auto;
  margin-top: 1rem;
}

.manager-nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin: 0 0 1.5rem;
  padding: 0.35rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-nav);
}

.manager-nav a {
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  text-decoration: none;
  color: #475569;
  background: transparent;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.manager-nav a:hover {
  background: #f1f5f9;
}

.manager-nav a.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.admin-nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin: 0 0 1.5rem;
  padding: 0.35rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-nav);
}

.admin-nav a {
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  text-decoration: none;
  color: #475569;
  background: transparent;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.admin-nav a:hover {
  background: #f1f5f9;
}

.admin-nav a.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.place-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.place-list-item {
  display: block;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.place-list-item:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.place-list-item strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.place-list-item .muted {
  display: block;
  font-size: 0.9rem;
}

.place-list-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #2563eb;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge-muted {
  background: #f1f5f9;
  color: #64748b;
}

.nav-badge {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0.1rem 0.4rem;
  margin-left: 0.25rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  vertical-align: middle;
}

.nav-badge.hidden {
  display: none;
}

.debts-section {
  margin: 1.5rem 0;
}

.debt-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

.debt-item strong {
  display: block;
}

.debt-selectable {
  display: grid;
  gap: 0.5rem;
}

.debt-check {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  cursor: pointer;
}

.debt-amount-label {
  font-size: 0.9rem;
  margin-left: 1.5rem;
}

.debt-amount-label input {
  width: 6rem;
  margin-left: 0.25rem;
}

.settlement-actions {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 8px;
}

.settlement-actions label {
  display: block;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.filter-tabs .btn.active {
  background: var(--primary, #2563eb);
  color: #fff;
  border-color: var(--primary, #2563eb);
}

.receipt-admin-item .receipt-admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.receipt-admin-actions {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.fns-badge {
  font-size: 0.85rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: #f3f4f6;
}

.fns-badge.fns-pending { background: #fef9c3; }
.fns-badge.fns-verified { background: #dcfce7; }
.fns-badge.fns-failed { background: #fee2e2; }
.fns-badge.fns-no_data { background: #e0e7ff; }

.alert-banner {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 8px;
}

.settlement-postpone.overdue {
  color: #b91c1c;
  font-weight: 500;
  margin: 0.35rem 0;
}

#receipt-qr-status:not(.hidden) {
  margin: 0.5rem 0;
  padding: 0.5rem 0.75rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 6px;
}

#receipt-qr-status.error {
  background: #fef2f2;
  border-color: #fca5a5;
}

.fns-fields {
  margin: 0.75rem 0;
  padding: 0.5rem 0.75rem;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}

.fns-fields summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.decode-hint {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  font-size: 0.85rem;
}

.payout-text {
  margin: 0.25rem 0 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.85rem;
}

.payout-place + .payout-place {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #bae6fd;
}

.doc-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
}

.settlement-upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

.settlement-upload-comment {
  flex: 1;
  min-width: 10rem;
  font-size: 0.85rem;
}

.hidden-file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
}

.settlement-upload-label {
  position: relative;
  cursor: pointer;
}

.settlement-reject-comment {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.btn-row-sm {
  margin-top: 0.5rem;
}

.receipt-section {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.receipt-section h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.recent-tx {
  margin-top: 1.5rem;
}

.tx-mini-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tx-mini-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.9rem;
}

.container.wide {
  max-width: 960px;
}

.blockchain-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.blockchain-entry {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.blockchain-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.blockchain-data {
  font-size: 0.75rem;
  background: #f9fafb;
  padding: 0.5rem;
  border-radius: 4px;
  overflow-x: auto;
  max-height: 120px;
}

.mono {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
}

.admin-nav {
  margin-bottom: 1rem;
}

.form.card {
  background: #fff;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

.recommendation-card {
  margin-bottom: 1rem;
  background: #f0f9ff;
  border-color: #bae6fd;
}

.recommendation-card h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.place-item {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.place-item .btn-row {
  display: flex;
  gap: 0.5rem;
}

.qr-canvas-wrap {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}

.qr-url {
  text-align: center;
  word-break: break-all;
  font-size: 0.9rem;
  color: #475569;
  margin-bottom: 1rem;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.legacy-list {
  display: grid;
  gap: 0.5rem;
}

.legacy-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: #fff;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.badge-ok {
  font-size: 0.75rem;
  color: #16a34a;
  background: #f0fdf4;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ——— Responsive: phone / tablet / desktop ——— */

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: var(--touch-min);
  height: var(--touch-min);
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  width: 1.25rem;
  height: 2px;
  margin: 0 auto;
  background: var(--color-text);
  border-radius: 1px;
}

section {
  margin-bottom: 1.5rem;
}

section h2 {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}

.client-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.client-hero {
  margin-bottom: 0.5rem;
}

.client-main {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.client-main .receipt-section {
  border: none;
  box-shadow: var(--shadow-sm);
}

.page-client .place-header h1 {
  font-size: 1.5rem;
  margin: 0 0 0.25rem;
  line-height: 1.2;
}

.page-client .place-header .muted {
  text-align: left;
}

.cashier-layout {
  max-width: var(--container-narrow);
}

/* Phone */
@media (max-width: 639px) {
  .site-header,
  .site-footer {
    padding: 0.75rem 1rem;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .header-inner {
    flex-wrap: wrap;
    position: relative;
  }

  .nav-toggle {
    display: flex;
    margin-left: auto;
  }

  .header-nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.35rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
  }

  .header-nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .header-user {
    margin-top: 0.35rem;
    padding: 0.65rem 0.75rem;
    border-left: none;
    border-top: 1px solid var(--color-border);
    border-radius: 8px;
    background: #f8fafc;
  }

  .header-user-email {
    max-width: none;
    width: 100%;
  }

  .header-logout-btn {
    width: 100%;
    min-height: var(--touch-min);
    margin-top: 0.25rem;
  }

  .header-nav.is-open {
    display: flex;
  }

  .header-nav a {
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: #f8fafc;
  }

  .container {
    padding: 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .cashier-code {
    font-size: 2.5rem;
    letter-spacing: 0.15em;
    padding: 1.25rem 0.75rem;
  }

  .code-section {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 0 -1rem 1rem;
    padding: 1rem;
    background: linear-gradient(180deg, var(--color-bg) 85%, transparent);
  }

  .info-cards {
    grid-template-columns: 1fr;
  }

  .client-balance-cards {
    margin: 0 0 1rem;
  }

  .client-main .receipt-section {
    order: -2;
    margin-bottom: 1.25rem;
  }

  .client-main section:has(#client-receipts-list) {
    order: -1;
  }

  .btn,
  .form input,
  .form select {
    min-height: var(--touch-min);
    font-size: 16px;
  }

  .btn-primary {
    width: 100%;
  }

  .client-main .receipt-section .btn-secondary {
    width: 100%;
  }

  .manager-nav,
  .admin-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.5rem;
    gap: 0.4rem;
  }

  .manager-nav::-webkit-scrollbar,
  .admin-nav::-webkit-scrollbar {
    display: none;
  }

  .manager-nav a,
  .admin-nav a {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .scroll-hint-wrap--nav .manager-nav,
  .scroll-hint-wrap--nav .admin-nav {
    padding-bottom: 0.35rem;
  }

  .filter-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
    margin-bottom: 0.75rem;
  }

  .filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .filter-tabs .btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .session-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.35rem;
  }

  .session-chips::-webkit-scrollbar {
    display: none;
  }

  .session-chip {
    flex-shrink: 0;
  }

  .place-item {
    flex-direction: column;
    align-items: stretch;
  }

  .place-item .btn-row {
    width: 100%;
  }

  .place-item .btn-row .btn {
    flex: 1;
  }

  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .filter-tabs .btn {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.8rem;
    padding: 0.5rem 0.4rem;
  }

  .scroll-hint-wrap--tabs .filter-tabs .btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .consent-banner .btn {
    width: 100%;
  }

  .site-footer {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Tablet */
@media (min-width: 640px) and (max-width: 1023px) {
  .container {
    max-width: 840px;
    padding: 1.25rem 1.5rem;
  }

  .container.narrow {
    max-width: 560px;
  }

  .cashier-layout {
    max-width: 640px;
  }

  .client-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem 1.5rem;
    align-items: start;
  }

  .client-hero {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.5rem;
    align-items: start;
  }

  .client-hero .place-header {
    grid-column: 1 / -1;
  }

  .client-hero .consent-banner {
    grid-column: 1 / -1;
  }

  .client-hero .code-section {
    margin: 0;
  }

  .client-hero .client-balance-cards {
    margin: 0;
    align-self: stretch;
  }

  .client-main {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.5rem;
  }

  .client-main .receipt-section,
  .client-main section:has(#client-receipts-list) {
    grid-column: 1 / -1;
  }

  .info-cards {
    grid-template-columns: 1fr;
    height: 100%;
  }

  .cashier-code {
    font-size: 2.75rem;
  }

  .form--split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .page-manager .container,
  .page-admin .container {
    max-width: var(--container-wide);
  }

  .info-cards.stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .scroll-hint-wrap--nav .admin-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.35rem;
  }

  .scroll-hint-wrap--nav .admin-nav::-webkit-scrollbar {
    display: none;
  }

  .scroll-hint-wrap--nav .admin-nav a {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .header-inner {
    max-width: var(--container-wide);
  }

  .header-nav {
    flex: 1;
    justify-content: flex-end;
  }

  .container {
    max-width: var(--container-default);
    padding: 1.75rem 2rem;
  }

  .container.wide,
  .page-manager .container,
  .page-admin .container {
    max-width: var(--container-wide);
  }

  .container.narrow {
    max-width: 480px;
  }

  .page-client .container.client-layout {
    max-width: var(--container-wide);
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
  }

  .client-hero {
    position: sticky;
    top: 1rem;
    margin: 0;
  }

  .client-hero .code-section {
    margin: 1rem 0;
  }

  .client-hero .info-cards {
    grid-template-columns: 1fr;
    margin: 0;
  }

  .client-main {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .client-main .receipt-section {
    order: -1;
    margin-bottom: 1.5rem;
  }

  .page-cashier .cashier-layout {
    max-width: 920px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem 2rem;
    align-items: start;
  }

  .page-cashier .cashier-layout > h1,
  .page-cashier .cashier-layout > .notice {
    grid-column: 1 / -1;
  }

  .page-cashier .recent-clients,
  .page-cashier #cashier-form {
    grid-column: 1;
  }

  .page-cashier .recent-tx,
  .page-cashier .receipt-section {
    grid-column: 2;
  }

  .page-cashier #cashier-form {
    position: sticky;
    top: 1rem;
  }

  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  #stats.info-cards {
    grid-template-columns: repeat(4, 1fr);
  }

  #fns-health-panel.info-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .manager-nav a,
  .admin-nav a {
    padding: 0.5rem 1rem;
  }

  .hint {
    text-align: left;
  }

  .page-client .code-section .hint,
  .page-client .code-section .label {
    text-align: center;
  }
}

/* ——— Production layout & panels ——— */

.backoffice-layout {
  max-width: var(--container-backoffice);
}

.page-head {
  margin-bottom: 1.5rem;
}

.page-head h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 2.5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.page-head .lead {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}

.page-foot {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}

.panel h2,
.panel h3 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.panel-accent {
  background: linear-gradient(165deg, #f8fafc 0%, #fff 55%);
  border-color: #dbeafe;
}

.panel-sticky {
  box-shadow: var(--shadow-card);
}

.panel-wide {
  grid-column: 1 / -1;
}

.balance-hero {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid #dbeafe;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #eff6ff 0%, #fff 70%);
  box-shadow: var(--shadow-card);
}

.balance-hero .info-value {
  font-size: 1.75rem;
  color: #1d4ed8;
}

.dashboard-grid {
  display: grid;
  gap: 1.25rem;
}

.settlements-grid {
  display: grid;
  gap: 1.25rem;
}

.admin-tools-grid {
  display: grid;
  gap: 1.25rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.fns-health-cards {
  grid-template-columns: 1fr;
  margin: 0.75rem 0;
}

.home-layout {
  max-width: 880px;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.home-hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.home-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
}

.home-hero .lead {
  font-size: 1.1rem;
  max-width: 36rem;
  margin: 0 auto;
}

.card-link {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  border: 1px solid var(--color-border);
}

.card-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: #93c5fd;
}

.card-link-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.card-link-desc {
  font-size: 0.9rem;
}

.page-auth .container {
  padding-top: 2rem;
}

.auth-layout {
  margin-top: 1rem;
}

.page-client .client-hero.panel {
  padding: 1.25rem;
}

.page-client .client-main .panel {
  margin-bottom: 1.25rem;
}

.page-client .client-main .panel:last-child {
  margin-bottom: 0;
}

.debt-item {
  transition: border-color 0.15s;
}

.debt-item:hover {
  border-color: #cbd5e1;
}

.place-item {
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: none;
}

.place-item:hover {
  border-color: #93c5fd;
}

.btn-primary {
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
  transition: background 0.15s, transform 0.1s;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-primary:active {
  transform: scale(0.98);
}

@media (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
    align-items: start;
  }

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

  .admin-tools-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-tools-grid .panel-wide {
    grid-column: 1 / -1;
  }

  .fns-health-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .page-client .container.client-layout {
    max-width: var(--container-backoffice);
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 1.75rem 2rem;
  }

  .page-client .client-hero.panel-sticky {
    position: sticky;
    top: 1rem;
  }

  .page-cashier .cashier-layout {
    max-width: 1000px;
  }

  .backoffice-layout .info-cards.stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .page-manager .place-list,
  .page-admin #receipts-list {
    max-height: none;
  }
}

@media (min-width: 1280px) {
  .home-layout {
    max-width: 960px;
  }

  .home-cards {
    gap: 1.25rem;
  }

  .home-receipt-section {
    margin-top: 2rem;
  }
}

/* ——— Горизонтальный скролл: подсказки ——— */

.scroll-hint-wrap {
  position: relative;
  --scroll-fade: 2.25rem;
}

.scroll-hint-wrap--nav {
  position: relative;
  margin-bottom: 1.5rem;
  overflow: visible;
}

.scroll-hint-wrap--nav .manager-nav,
.scroll-hint-wrap--nav .admin-nav {
  margin-bottom: 0;
  overflow-y: hidden;
}

.scroll-hint-wrap [data-scroll-target] {
  outline: none;
}

.scroll-hint-wrap [data-scroll-target]:focus-visible {
  box-shadow: 0 0 0 2px var(--color-primary-soft), 0 0 0 3px var(--color-primary);
}

.scroll-hint-badge {
  display: none;
  position: absolute;
  right: 0.35rem;
  top: calc(50% + 5px);
  transform: translateY(-50%);
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-primary);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  pointer-events: none;
  z-index: 3;
  animation: scroll-hint-nudge 2s ease-in-out infinite;
}

/* Бейдж у нижнего края полосы меню (top:100%, без transform — иначе анимация сбивает позицию) */
.scroll-hint-wrap--nav .scroll-hint-badge {
  top: 100%;
  right: 0.35rem;
  bottom: auto;
  margin-top: -1px;
  transform: none;
  animation: scroll-hint-nudge-nav 2s ease-in-out infinite;
}

.scroll-hint-caption {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--color-muted);
  text-align: center;
}

.scroll-hint-wrap.has-overflow:not(.at-end)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: var(--scroll-fade);
  background: linear-gradient(to right, transparent, var(--color-surface));
  pointer-events: none;
  z-index: 2;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.scroll-hint-wrap.has-overflow:not(.at-start)::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--scroll-fade);
  background: linear-gradient(to left, transparent, var(--color-surface));
  pointer-events: none;
  z-index: 2;
  border-radius: var(--radius) 0 0 var(--radius);
}

.scroll-hint-wrap.has-overflow:not(.at-end) .scroll-hint-badge {
  display: flex;
  align-items: center;
}

.scroll-hint-wrap--tabs.has-overflow:not(.at-end)::after,
.scroll-hint-wrap--chips.has-overflow:not(.at-end)::after {
  bottom: auto;
  height: 100%;
}

.scroll-hint-wrap--table.has-overflow:not(.at-end)::after {
  border-radius: 0;
}

@keyframes scroll-hint-nudge {
  0%, 100% { transform: translateY(-50%) translateX(0); opacity: 1; }
  50% { transform: translateY(-50%) translateX(4px); opacity: 0.85; }
}

@keyframes scroll-hint-nudge-nav {
  0%, 100% { transform: translateX(0); opacity: 1; }
  50% { transform: translateX(4px); opacity: 0.85; }
}

.page-legal .legal-layout {
  max-width: var(--container-default);
}

.page-legal .legal-content h1 {
  margin-top: 0;
}

.page-public .place-list-cta {
  margin-top: 0.5rem;
}

.home-receipt-section {
  margin-top: 2.5rem;
}

.page-proxy .container.center {
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

