:root {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  color: #111827;
  background: #f4f6f8;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: #f4f6f8; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 1120px; margin: 0 auto; min-height: 100vh; padding: 0 20px 98px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: max(18px, env(safe-area-inset-top)) 0 18px; }
.brand-row { display: flex; align-items: center; gap: 12px; }
.logo-mark { width: 44px; height: 44px; border-radius: 13px; background: #111827; color: white; display: grid; place-items: center; font-weight: 800; letter-spacing: -1px; }
h1 { margin: 0; font-size: 24px; letter-spacing: -0.5px; }
.subtitle { margin: 2px 0 0; color: #6b7280; font-size: 13px; }
.view { display: none; }
.view.active { display: block; }
.hero-card, .scan-card, .panel, .contact-form { background: white; border: 1px solid #e5e7eb; border-radius: 20px; box-shadow: 0 8px 30px rgba(17,24,39,.05); }
.hero-card { padding: 26px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.hero-card h2 { margin: 2px 0 8px; font-size: clamp(28px, 5vw, 42px); letter-spacing: -1.2px; }
.eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 800; letter-spacing: .12em; color: #6b7280; }
.muted, .hint, .privacy-note { color: #6b7280; }
.muted { margin: 0; max-width: 680px; line-height: 1.45; }
.primary, .secondary, .danger, .file-button { border: 0; border-radius: 12px; min-height: 44px; padding: 10px 15px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.primary { background: #111827; color: white; }
.secondary, .file-button { background: #eef1f5; color: #111827; }
.danger { background: #fee2e2; color: #991b1b; }
.primary:disabled { opacity: .45; cursor: default; }
.toolbar { display: grid; grid-template-columns: 1fr 260px; gap: 12px; margin: 18px 0; }
input, select, textarea { width: 100%; border: 1px solid #d1d5db; background: white; border-radius: 12px; padding: 12px 13px; color: #111827; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #111827; box-shadow: 0 0 0 3px rgba(17,24,39,.08); }
.empty-state { text-align: center; padding: 64px 22px; color: #4b5563; }
.empty-state h3 { color: #111827; margin-bottom: 6px; }
.empty-icon { width: 66px; height: 66px; margin: auto; display: grid; place-items: center; background: white; border: 1px solid #e5e7eb; border-radius: 20px; font-size: 30px; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.button-row.center { justify-content: center; }
.contact-list { display: grid; gap: 10px; }
.contact-item { background: white; border: 1px solid #e5e7eb; border-radius: 16px; padding: 17px 18px; display: grid; grid-template-columns: minmax(180px,1.2fr) minmax(160px,1fr) minmax(180px,1fr) auto; gap: 18px; align-items: center; }
.contact-item:hover { border-color: #cbd5e1; }
.contact-name { font-weight: 800; font-size: 16px; }
.contact-meta { color: #6b7280; font-size: 13px; margin-top: 3px; }
.contact-cell { min-width: 0; overflow-wrap: anywhere; }
.contact-action { background: transparent; border: 0; font-weight: 700; padding: 8px 5px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 5px 0 16px; }
.section-head h2 { margin: 0; font-size: 32px; letter-spacing: -.7px; }
.scan-card, .contact-form { padding: 24px; }
.event-label, .contact-form label { display: grid; gap: 7px; font-weight: 700; font-size: 14px; }
.hint { font-size: 12px; margin: 6px 0 20px; }
.capture-box { min-height: 230px; border: 2px dashed #cbd5e1; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; gap: 7px; background: #f8fafc; cursor: pointer; }
.capture-box span { color: #6b7280; font-size: 13px; }
.camera-icon { width: 52px; height: 52px; background: #111827; color: white; border-radius: 50%; display: grid; place-items: center; font-size: 28px; }
.preview { display: block; width: 100%; max-height: 390px; object-fit: contain; margin: 18px 0; border-radius: 14px; background: #eef1f5; }
.ocr-status { margin: 16px 0; }
.progress-track { height: 8px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.progress-bar { width: 0; height: 100%; background: #111827; transition: width .2s ease; }
.ocr-status span { font-size: 13px; color: #4b5563; }
.privacy-note { margin: 18px 0 0; font-size: 12px; line-height: 1.45; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.contact-form { display: grid; gap: 15px; }
.contact-form textarea { resize: vertical; }
.ocr-details { border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px; }
.ocr-details summary { cursor: pointer; font-weight: 700; }
.ocr-details textarea { margin-top: 12px; }
.sticky-actions { position: static; padding-top: 10px; }
.field-warning { margin: -6px 0 0; padding: 10px 12px; border-radius: 12px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-size: 13px; font-weight: 700; }
.export-grid { display: grid; gap: 14px; }
.panel { padding: 22px; }
.panel h3 { margin-top: 0; }
.panel p { color: #6b7280; line-height: 1.5; }
.warning-panel { background: #fffbeb; border-color: #fde68a; }
.file-button { position: relative; overflow: hidden; cursor: pointer; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.bottom-nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom)); width: min(640px, calc(100% - 24px)); z-index: 20; background: rgba(17,24,39,.94); backdrop-filter: blur(16px); display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; border-radius: 18px; padding: 6px; box-shadow: 0 18px 50px rgba(17,24,39,.22); }
.nav-item { border: 0; background: transparent; color: #cbd5e1; border-radius: 13px; min-height: 50px; font-weight: 700; }
.nav-item.active { background: white; color: #111827; }
.scan-nav { color: white; }
.toast { position: fixed; left: 50%; transform: translateX(-50%) translateY(20px); bottom: 90px; background: #111827; color: white; border-radius: 12px; padding: 11px 14px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 30; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 760px) {
  .app-shell { padding-left: 14px; padding-right: 14px; }
  .subtitle { display: none; }
  .hero-card { align-items: flex-start; flex-direction: column; padding: 20px; }
  .hero-card .primary { width: 100%; }
  .toolbar { grid-template-columns: 1fr; }
  .contact-item { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .contact-item .org-cell, .contact-item .email-cell { grid-column: 1 / -1; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .scan-card, .contact-form { padding: 18px; }
  .section-head h2 { font-size: 27px; }
}

.apple-ocr-box { display:flex; gap:14px; align-items:flex-start; padding:16px; margin:18px 0 14px; border:1px solid #dbeafe; background:#eff6ff; border-radius:16px; }
.apple-ocr-box strong { display:block; margin-bottom:4px; }
.apple-ocr-box p { margin:0; color:#475569; font-size:13px; line-height:1.45; }
.apple-ocr-icon { flex:0 0 auto; width:42px; height:42px; border-radius:12px; display:grid; place-items:center; background:#111827; color:#fff; font-weight:800; }
.paste-label { display:block; margin:18px 0 7px; font-weight:700; font-size:14px; }
#appleOcrInput { min-height:150px; font-family:inherit; line-height:1.4; margin-bottom:12px; }
.fallback-box { margin-top:18px; border:1px solid #e5e7eb; border-radius:14px; padding:14px; }
.fallback-box summary { font-weight:700; cursor:pointer; }
.fallback-box .capture-box { margin-top:12px; min-height:170px; }
#launchShortcutBtn { text-align:center; }


/* CardFlow v9 - synchronisation cloud */
.sync-panel { background:#f8fafc; border-color:#dbe3ed; }
.sync-title-row { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; }
.sync-title-row h3 { margin-bottom:4px; }
.sync-title-row p { margin:0; }
.sync-badge { flex:0 0 auto; display:inline-flex; align-items:center; min-height:30px; padding:5px 10px; border-radius:999px; font-size:12px; font-weight:800; }
.sync-badge.offline { background:#eef1f5; color:#475569; }
.sync-badge.online { background:#dcfce7; color:#166534; }
.sync-badge.syncing { background:#dbeafe; color:#1d4ed8; }
.sync-badge.error { background:#fee2e2; color:#991b1b; }
.sync-login-grid { margin:16px 0 12px; }
.sync-account { margin:16px 0 10px; color:#334155; }
.sync-stats { display:flex; flex-wrap:wrap; gap:8px 16px; margin:0 0 14px; color:#64748b; font-size:13px; }
.sync-stats span { display:inline-flex; gap:4px; align-items:center; }
.sync-stats strong { color:#111827; }
@media (max-width:760px) { .sync-title-row { flex-direction:column; } .sync-badge { align-self:flex-start; } }

.duplex-box { background:#fbfdff; border-color:#cbd5e1; }
.duplex-box > summary { color:#0f172a; }
.duplex-side { margin-top:16px; padding-top:14px; border-top:1px solid #e5e7eb; }
.duplex-side strong { display:block; margin-bottom:10px; }
.duplex-side textarea { width:100%; margin-top:10px; box-sizing:border-box; min-height:110px; }
