/* ============================================================
 *  INTIMO IN — Raccolta Dati Clienti & Fidelity
 *  Sober, modern, beautiful light theme inspired by Intimo In branding
 * ============================================================ */

/* ─── Google Fonts ───────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,600;0,700;1,600&display=swap');

/* ─── CSS Custom Properties ──────────────────────────────── */
:root {
  /* Surfaces — Clean, modern white & subtle slate */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8fafc;
  --bg-input: #ffffff;
  --bg-muted: #f1f5f9;

  /* Typography */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  /* Intimo In Brand Palette (from logo) */
  --brand-blue: #1f0b9e;
  --brand-blue-hover: #160773;
  --brand-blue-light: rgba(31, 11, 158, 0.07);
  --brand-blue-glow: rgba(31, 11, 158, 0.16);
  --brand-gradient: #1f0b9e;
  --brand-gradient-soft: #f5f4ff;

  /* Logo Secondary Accents (Venus pink & Mars cyan) */
  --accent-pink: #e05697;
  --accent-pink-light: rgba(224, 86, 151, 0.1);
  --accent-cyan: #0284c7;
  --accent-cyan-light: rgba(2, 132, 199, 0.1);

  /* Status Colors */
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --warning: #d97706;
  --warning-bg: #fffbeb;

  /* Borders */
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --border-focus: #1f0b9e;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 18px -2px rgba(31, 11, 158, 0.06), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 28px -4px rgba(31, 11, 158, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.04);
  --shadow-brand: 0 6px 20px rgba(31, 11, 158, 0.25);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  /* Safe Area */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overscroll-behavior-y: none;
  touch-action: manipulation;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body, button, nav, header {
  user-select: none;
  -webkit-user-select: none;
}

input, textarea, select {
  user-select: text;
  -webkit-user-select: text;
}

/* ─── Subtle Ambient Background ──────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: #ffffff;
  pointer-events: none;
  z-index: 0;
}

/* ─── App Container ──────────────────────────────────────── */
.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 490px;
  margin: 0 auto;
  padding: 0 18px;
  padding-top: calc(16px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bottom));
}

/* ─── Header ─────────────────────────────────────────────── */
.app-header {
  text-align: center;
  padding: 20px 0 16px;
}

.brand-logo-wrapper {
  max-width: 220px;
  margin: 0 auto 10px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(31, 11, 158, 0.18);
  border: 2px solid #ffffff;
  background: #1f0b9e;
  transition: transform var(--transition-normal);
}

.brand-logo-wrapper:hover {
  transform: translateY(-2px);
}

.app-logo-brand {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.app-title {
  display: none;
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--brand-blue);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.app-subtitle {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

/* ─── Logout Button ──────────────────────────────────────── */
.logout-btn {
  position: fixed;
  top: calc(14px + var(--safe-top));
  right: 14px;
  min-width: 72px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.logout-btn.visible {
  display: flex;
}

.logout-btn:hover {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-border);
  transform: scale(1.05);
}

/* ─── Install Banner ─────────────────────────────────────── */
.install-banner {
  display: none;
  background: #1f0b9e;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  color: #ffffff;
  transition: all var(--transition-normal);
}

.install-banner.visible {
  display: flex;
}

.install-banner:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.install-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: #ffffff;
}

.install-text strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
}

.install-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #ffffff;
  min-width: 64px;
  height: 30px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.install-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ─── Screens ────────────────────────────────────────────── */
.screen {
  display: none;
  flex: 1;
  animation: fadeSlideIn 0.35s var(--transition-smooth);
}

.screen.active {
  display: flex;
  flex-direction: column;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── PIN Lock Screen ────────────────────────────────────── */
.pin-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 28px;
  padding: 10px 0 30px;
}

.pin-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-brand);
  position: relative;
  animation: gentlePulse 3s ease-in-out infinite;
}

.pin-icon::before {
  content: "";
  width: 24px;
  height: 18px;
  border: 3px solid #ffffff;
  border-radius: 8px 8px 10px 10px;
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
}

.pin-icon::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 3px solid #ffffff;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
}

@keyframes gentlePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 18px rgba(31, 11, 158, 0.22); }
  50% { transform: scale(1.03); box-shadow: 0 8px 28px rgba(31, 11, 158, 0.35); }
}

.pin-title {
  font-size: 1.45rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
}

.pin-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: -18px;
  text-align: center;
}

.pin-input-group {
  display: flex;
  gap: 14px;
  justify-content: center;
}

.pin-digit {
  width: 54px;
  height: 62px;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
  caret-color: var(--brand-blue);
}

.pin-digit:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px var(--brand-blue-glow);
  transform: translateY(-2px);
}

.pin-digit.filled {
  border-color: var(--brand-blue);
  background: rgba(31, 11, 158, 0.03);
}

.pin-error {
  color: var(--error);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: center;
  min-height: 1.3em;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ─── Role Badge ─────────────────────────────────────────── */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.role-badge.owner {
  background: var(--brand-blue-light);
  color: var(--brand-blue);
  border: 1px solid rgba(31, 11, 158, 0.2);
}

.role-badge.employee {
  background: rgba(2, 132, 199, 0.08);
  color: #0369a1;
  border: 1px solid rgba(2, 132, 199, 0.2);
}

/* ─── Navigation Tabs (Owner Only) ───────────────────────── */
.nav-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 5px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.nav-tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.nav-tab.active {
  background: var(--brand-gradient);
  color: #ffffff;
  box-shadow: var(--shadow-brand);
}

.nav-tab:not(.active):hover {
  color: var(--brand-blue);
  background: var(--brand-blue-light);
}

/* ─── Card ───────────────────────────────────────────────── */
.card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition-normal);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title .icon {
  font-size: 1.3rem;
}

/* ─── Form Inputs ────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 7px;
}

.form-label .required {
  color: var(--accent-pink);
  margin-left: 2px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px; /* Prevents zoom on iOS */
  font-family: inherit;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px var(--brand-blue-glow);
}

.form-input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.form-error {
  font-size: 0.8rem;
  color: var(--error);
  margin-top: 6px;
  font-weight: 500;
  display: none;
}

.form-error.visible {
  display: block;
  animation: fadeSlideIn 0.2s ease;
}

/* ─── Privacy Section ────────────────────────────────────── */
.privacy-section {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-blue);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 22px;
}

.privacy-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  margin-bottom: 12px;
}

.privacy-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  margin-top: 2px;
}

.privacy-toggle input[type="checkbox"]:checked {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
}

.privacy-toggle input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  background: #ffffff;
  border-radius: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.privacy-label-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.privacy-label-text strong {
  color: var(--text-primary);
}

.privacy-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.privacy-doc-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--brand-blue);
  text-decoration: none;
  background: var(--brand-blue-light);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31, 11, 158, 0.15);
  transition: all var(--transition-fast);
}

.privacy-doc-link:hover {
  background: rgba(31, 11, 158, 0.12);
  text-decoration: underline;
  transform: translateY(-1px);
}

.privacy-expand-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.privacy-expand-btn:hover {
  color: var(--brand-blue);
}

.privacy-full-text {
  display: none;
  margin-top: 12px;
  padding: 14px 16px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.65;
  border: 1px solid var(--border);
}

.privacy-full-text.visible {
  display: block;
  animation: fadeSlideIn 0.3s ease;
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  width: 100%;
  padding: 15px 22px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--brand-gradient);
  color: #ffffff;
  box-shadow: var(--shadow-brand);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(31, 11, 158, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
  color: var(--brand-blue);
}

.btn-sm {
  padding: 9px 14px;
  font-size: 0.84rem;
}

/* Spinner inside button */
.btn .spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn.loading .spinner {
  display: block;
}

.btn.loading .btn-text {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Success Feedback Screen ────────────────────────────── */
.feedback {
  display: none;
  text-align: center;
  padding: 10px 0 24px;
  animation: fadeSlideIn 0.4s var(--transition-smooth);
}

.feedback.visible {
  display: block;
}

.feedback-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 16px;
}

.feedback-icon.success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.feedback-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.feedback-message {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

/* ─── Digital Loyalty Card (Tessera Fedeltà) ─────────────── */
.loyalty-card {
  background: #1f0b9e;
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  margin: 16px 0 24px;
  box-shadow: 0 14px 34px -4px rgba(31, 11, 158, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Subtle decorative blocks referencing the logo without gradients */
.loyalty-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(224, 86, 151, 0.12);
  pointer-events: none;
}

.loyalty-card::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(2, 132, 199, 0.12);
  pointer-events: none;
}

.loyalty-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.loyalty-card-badge {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #f472b6;
  text-transform: uppercase;
}

.loyalty-card-id {
  font-size: 0.75rem;
  font-family: monospace;
  color: #93c5fd;
  background: rgba(255, 255, 255, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
}

.loyalty-card-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}

/* ─── Barcode Container ──────────────────────────────────── */
.barcode-box {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 14px 16px 10px;
  margin: 0 auto 16px;
  max-width: 330px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

.barcode-canvas {
  width: 100%;
  max-width: 300px;
  height: 90px;
  display: block;
}

.barcode-digits {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.16em;
  margin-top: 6px;
  user-select: text;
  -webkit-user-select: text;
}

.barcode-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.barcode-actions .btn {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
}

.barcode-actions .btn:hover {
  background: #ffffff;
  color: var(--brand-blue);
}

/* ─── Data View (Owner Screen) ───────────────────────────── */
.data-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.data-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.refresh-btn {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.refresh-btn:hover {
  color: var(--brand-blue);
  border-color: var(--brand-blue);
  box-shadow: var(--shadow-sm);
}

.refresh-btn.spinning {
  animation: spin 0.8s linear infinite;
  pointer-events: none;
}

.search-bar {
  position: relative;
  margin-bottom: 14px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 13px 16px 13px 42px;
  font-size: 15px;
  font-family: inherit;
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px var(--brand-blue-glow);
}

.data-counter {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-align: right;
  font-weight: 500;
}

.data-counter strong {
  color: var(--brand-blue);
  font-weight: 700;
}

/* ─── Client Card List ───────────────────────────────────── */
.client-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.client-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  animation: fadeSlideIn 0.3s ease;
}

.client-card:hover {
  border-color: rgba(31, 11, 158, 0.25);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.client-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.client-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}

.client-id {
  font-size: 0.72rem;
  color: var(--text-secondary);
  background: var(--bg-muted);
  padding: 3px 8px;
  border-radius: 6px;
  font-family: monospace;
}

.client-ean-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  color: var(--brand-blue);
  font-family: 'Courier New', Courier, monospace;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-top: 4px;
  background: var(--brand-blue-light);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(31, 11, 158, 0.15);
}

.client-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.client-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.client-detail-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.client-detail-value {
  font-size: 0.88rem;
  color: var(--text-secondary);
  word-break: break-all;
}

.client-detail-value a {
  color: var(--brand-blue);
  text-decoration: none;
  font-weight: 500;
}

.client-detail-value a:hover {
  text-decoration: underline;
}

.client-meta {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.client-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.client-barcode-btn {
  background: var(--brand-blue-light);
  border: 1px solid rgba(31, 11, 158, 0.25);
  color: var(--brand-blue);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.client-barcode-btn:hover {
  background: var(--brand-blue);
  color: #ffffff;
  border-color: var(--brand-blue);
  transform: translateY(-1px);
}

.client-email-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
}

.client-email-badge.sent {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.client-email-badge.failed {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty-state p {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* ─── Barcode Modal (Scanner View) ───────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.visible {
  display: flex;
  animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 24px 24px;
  max-width: 420px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: modalZoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2);
  text-align: center;
}

@keyframes modalZoomIn {
  from { transform: scale(0.93); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-border);
}

.modal-header {
  margin-bottom: 18px;
}

.modal-subtitle {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--brand-blue);
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-id {
  font-size: 0.82rem;
  font-family: monospace;
  color: var(--text-muted);
  margin-top: 4px;
  display: inline-block;
}

.modal-barcode-box {
  max-width: 360px;
  padding: 18px 16px 14px;
  margin-bottom: 22px;
  border: 2px solid #e2e8f0;
}

.modal-barcode-box .barcode-canvas {
  height: 105px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ─── Toast Notifications ────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 440px;
}

.toast {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.35s ease;
  box-shadow: var(--shadow-lg);
}

.toast.success {
  background: #ffffff;
  color: #166534;
  border: 1.5px solid var(--success-border);
  box-shadow: 0 8px 24px rgba(22, 101, 52, 0.12);
}

.toast.error {
  background: #ffffff;
  color: #991b1b;
  border: 1.5px solid var(--error-border);
  box-shadow: 0 8px 24px rgba(153, 27, 27, 0.12);
}

.toast.info {
  background: #ffffff;
  color: var(--brand-blue);
  border: 1.5px solid rgba(31, 11, 158, 0.2);
  box-shadow: 0 8px 24px rgba(31, 11, 158, 0.12);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(20px); }
}

/* ─── Loading Overlay ────────────────────────────────────── */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.loading-overlay.visible {
  display: flex;
}

.loading-content {
  text-align: center;
  animation: fadeSlideIn 0.3s ease;
}

.loading-spinner-large {
  width: 48px;
  height: 48px;
  border: 3.5px solid rgba(31, 11, 158, 0.12);
  border-top-color: var(--brand-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

.loading-text {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
}

/* ─── Login (solo password) ──────────────────────────────── */
.login-password {
  max-width: 320px;
  text-align: center;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
}

.pin-screen .btn {
  max-width: 320px;
}

/* ─── Dipendenti ─────────────────────────────────────────── */
.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.staff-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.staff-date {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.staff-remove-btn {
  flex-shrink: 0;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.staff-remove-btn:hover {
  background: var(--error);
  color: #ffffff;
  border-color: var(--error);
}

/* ─── Utility Classes ────────────────────────────────────── */
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex-row { display: flex; gap: 12px; }
.flex-1 { flex: 1; }

/* ─── Scrollbar Styling ──────────────────────────────────── */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
