/* CENTRAX ID — mobile app styles */
:root {
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --navy: #0B1F3A;
  --navy-2: #13294B;
  --blue: #1E88E5;
  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --text: #16202E;
  --muted: #6B7688;
  --line: #E3E8F0;
  --danger: #D93025;
  --success: #188038;
  --warning: #B06000;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(11, 31, 58, .12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1422; --surface: #152033; --text: #E8EDF5; --muted: #98A3B6; --line: #24324A;
    --shadow: 0 10px 30px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100vh; padding-bottom: calc(24px + var(--safe-bottom));
}
a { color: var(--blue); text-decoration: none; }
img { max-width: 100%; }
[hidden] { display: none !important; }
code { background: rgba(127,127,127,.15); padding: 1px 5px; border-radius: 5px; font-size: .9em; }

/* ---------- Top bar + menu ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-top)) 12px 10px; background: var(--navy); color: #fff;
}
.topbar-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar-title { font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 6px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: transparent; color: inherit;
  display: inline-grid; place-items: center; font-size: 19px; cursor: pointer;
}
.icon-btn:active { background: rgba(255,255,255,.15); }
.icon-btn.sm { width: 34px; height: 34px; font-size: 15px; color: var(--muted); }
.menu-backdrop, .sheet-backdrop { position: fixed; inset: 0; background: rgba(5, 12, 24, .45); z-index: 40; }
.menu-sheet {
  position: fixed; top: calc(8px + var(--safe-top)); right: 8px; z-index: 50; width: min(290px, calc(100vw - 16px));
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 8px; animation: pop .15s ease-out;
}
.menu-sheet a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; color: var(--text); font-weight: 500; }
.menu-sheet a i { width: 20px; text-align: center; color: var(--muted); }
.menu-sheet a.active, .menu-sheet a:active { background: rgba(30,136,229,.1); }
.menu-sheet a.active i { color: var(--blue); }
.menu-sheet a.danger, .menu-sheet a.danger i { color: var(--danger); }
.menu-user { display: flex; gap: 10px; align-items: center; padding: 8px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-user small { display: block; color: var(--muted); font-size: 12px; }
.avatar-sm { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

.app-main { max-width: 520px; margin: 0 auto; padding: 16px; }

/* ---------- Alerts / toast ---------- */
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-size: 14px; }
.alert-success { background: #E6F4EA; color: #0D652D; }
.alert-error { background: #FCE8E6; color: #A50E0E; }
.alert-warning { background: #FEF7E0; color: #7A4B00; }
.alert-info { background: #E8F0FE; color: #174EA6; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translate(-50%, 30px); opacity: 0;
  background: #1F2A3C; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 100; transition: .25s; max-width: 90vw; font-size: 14px;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast[data-type="error"] { background: var(--danger); }
.toast[data-type="success"] { background: var(--success); }

/* ---------- Buttons / forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px;
  padding: 12px 18px; font: 600 15px/1.2 var(--font); cursor: pointer; text-decoration: none; min-height: 46px;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:disabled { opacity: .5; }
.btn-light { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn-danger-outline { background: transparent; color: var(--danger); border: 1px solid var(--danger); margin-top: 14px; }
.btn-block { width: 100%; }
.btn-ms { width: 100%; background: #fff; color: #242424; border: 1px solid #8C8C8C; font-weight: 600; margin-bottom: 8px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=password], input:not([type]), input[inputmode],
select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 12px 13px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: 400 16px/1.3 var(--font); /* 16px avoids iOS zoom */
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(30,136,229,.45); border-color: var(--blue); }
fieldset { border: 0; padding: 0; margin: 0 0 12px; }
legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.switch-row, .radio-row { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--text); font-size: 15px; }
.switch-row input, .radio-row input { width: 20px; height: 20px; accent-color: var(--navy); }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.section-title { font-size: 16px; margin: 4px 0 14px; display: flex; gap: 8px; align-items: center; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: rgba(30,136,229,.12); color: var(--blue); }
.badge-ms { background: rgba(11,31,58,.08); color: var(--text); }

/* ---------- Login ---------- */
.login-body { background: linear-gradient(160deg, var(--navy) 0%, #1B3A66 100%); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 22px; padding: 28px 22px; box-shadow: var(--shadow); }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand h1 { margin: 12px 0 2px; font-size: 24px; }
.login-brand p { margin: 0; color: var(--muted); }
.brand-mark { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 28px; }
.manual-login { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.manual-login summary { cursor: pointer; color: var(--muted); font-size: 14px; text-align: center; padding: 6px; list-style: none; }
.manual-login summary::-webkit-details-marker { display: none; }
.manual-login form { margin-top: 12px; }
.login-note { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0 0; }

/* ---------- The card ---------- */
.dcard {
  --accent: var(--navy);
  position: relative; background: #fff; color: #16202E; border-radius: 24px; overflow: hidden; box-shadow: var(--shadow);
}
.dcard-band {
  height: 128px; padding: 16px; background:
    radial-gradient(circle at 85% -20%, rgba(255,255,255,.22), transparent 55%),
    linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000));
}
.dcard-logos { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.logo-chip { background: #fff; border-radius: 10px; padding: 6px 10px; height: 44px; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.12); opacity: .85; }
.logo-chip.is-current { opacity: 1; outline: 2px solid rgba(255,255,255,.8); }
.logo-chip img { display: block; height: 32px; width: auto; max-width: 120px; object-fit: contain; }
.dcard-photo { display: flex; justify-content: center; margin-top: -58px; position: relative; }
.dcard-photo img {
  width: 116px; height: 116px; border-radius: 50%; object-fit: cover; border: 5px solid #fff; background: #E9EEF5;
  box-shadow: 0 6px 18px rgba(0,0,0,.15);
}
.dcard-body { text-align: center; padding: 10px 20px 20px; }
.dcard-name { margin: 6px 0 2px; font-size: 24px; letter-spacing: -.01em; }
.dcard-title { margin: 0; color: #4A5568; font-weight: 500; }
.dcard-company { margin: 2px 0 0; color: var(--accent); font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; }
.dcard-qr { margin: 16px auto 6px; display: block; width: 190px; height: 190px; padding: 8px; border: 1px solid #E3E8F0; border-radius: 16px; background: #fff; cursor: zoom-in; }
.qr-target, .qr-target svg { display: block; width: 100%; height: 100%; }
.dcard-hint { margin: 4px 0 0; font-size: 12px; color: #6B7688; }

.company-switch { display: flex; gap: 8px; overflow-x: auto; padding: 14px 2px 2px; scrollbar-width: none; }
.chip {
  --chip: var(--blue); display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 99px; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 500 14px/1 var(--font); cursor: pointer; margin: 0;
}
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip .dot, .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--chip); display: inline-block; flex: none; }

.card-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.card-actions.compact { grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); }
.action {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 16px; border: 0;
  background: var(--surface); color: var(--text); font: 600 12px/1.1 var(--font); cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.action i { font-size: 20px; color: var(--navy); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .action i { color: #8AB4F8; } }

.info-list { list-style: none; margin: 0 0 16px; padding: 4px 0; background: var(--surface); border-radius: var(--radius); }
.info-list li + li { border-top: 1px solid var(--line); }
.info-list a { display: flex; gap: 14px; align-items: center; padding: 12px 16px; color: var(--text); }
.info-list i { width: 22px; text-align: center; color: var(--blue); font-size: 17px; }
.info-list span { min-width: 0; word-break: break-word; }
.info-list small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.socials { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.socials a {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--surface);
  color: var(--navy); font-size: 19px; box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .socials a { color: #E8EDF5; } }

.qr-overlay { position: fixed; inset: 0; z-index: 90; background: #fff; display: grid; place-items: center; padding: 24px; }
.qr-overlay-inner { text-align: center; width: 100%; max-width: 420px; color: #16202E; }
.qr-big { width: min(86vw, 380px); aspect-ratio: 1; margin: 0 auto 16px; }
.public-foot { text-align: center; color: var(--muted); font-size: 12px; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state > i { font-size: 46px; color: var(--line); margin-bottom: 8px; }
.empty-state h2 { color: var(--text); font-size: 19px; margin: 8px 0; }

/* ---------- Rolodex ---------- */
.search-bar { position: relative; display: flex; align-items: center; gap: 4px; background: var(--surface); border-radius: 14px; padding: 0 6px 0 14px; border: 1px solid var(--line); }
.search-bar > i { color: var(--muted); }
.search-bar input { border: 0; margin: 0; background: transparent; outline: none !important; }
.search-help { font-size: 13px; background: var(--surface); padding: 10px 14px; border-radius: 12px; margin-top: 8px; color: var(--muted); }
.search-help p { margin: 4px 0; }
.filter-row { display: flex; align-items: center; gap: 6px; margin: 12px 0 6px; }
.scroll-x { display: flex; gap: 8px; overflow-x: auto; flex: 1; scrollbar-width: none; padding-bottom: 2px; }
.scroll-x::-webkit-scrollbar { display: none; }
.list-meta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; margin: 6px 2px 8px; }
.list-meta select { width: auto; margin: 0; padding: 6px 10px; font-size: 13px; }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list > li { position: relative; background: var(--surface); border-radius: 16px; margin-bottom: 8px; }
.contact-row { display: flex; gap: 12px; align-items: center; padding: 12px 48px 12px 12px; color: var(--text); }
.contact-row strong { display: block; }
.contact-row small { display: block; color: var(--muted); font-size: 13px; }
.contact-row .grow { min-width: 0; }
.thumb { width: 64px; height: 42px; object-fit: cover; border-radius: 8px; flex: none; background: var(--line); }
.avatar-ini { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(30,136,229,.12); color: var(--blue); font-weight: 700; flex: none; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.tag { --chip: var(--blue); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; color: var(--chip); background: color-mix(in srgb, var(--chip) 14%, transparent); }
mark { background: #FFE8A3; color: inherit; border-radius: 3px; padding: 0 1px; }
.star { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; font-size: 18px; color: var(--muted); padding: 10px; cursor: pointer; }
.star.on { color: #F2B600; }
.no-results { text-align: center; color: var(--muted); padding: 30px 10px; background: none !important; }
.grow { flex: 1; }

.fab-wrap { position: fixed; right: 18px; bottom: calc(22px + var(--safe-bottom)); z-index: 35; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.fab { width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; font-size: 22px; box-shadow: var(--shadow); cursor: pointer; }
.fab-menu { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 6px; }
.fab-menu a { display: flex; gap: 12px; align-items: center; padding: 12px 16px; color: var(--text); font-weight: 500; white-space: nowrap; }
.fab-menu a i { color: var(--blue); width: 18px; }

.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface); border-radius: 22px 22px 0 0; padding: 12px 16px calc(20px + var(--safe-bottom)); max-height: 80vh; overflow: auto; box-shadow: var(--shadow); max-width: 560px; margin: 0 auto; }
.sheet header { display: flex; justify-content: space-between; align-items: center; }
.sheet h3 { margin: 6px 0; }
.inline-form { display: flex; gap: 8px; align-items: center; margin: 8px 0 12px; }
.inline-form input[type=text] { margin: 0; }
.inline-form input[type=color] { width: 46px; height: 46px; border: 0; background: none; padding: 0; flex: none; }
.cat-manage { list-style: none; margin: 0; padding: 0; }
.cat-manage li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.cat-manage small { color: var(--muted); }

/* ---------- Contact ---------- */
.contact-hero { text-align: center; margin-bottom: 8px; }
.contact-hero h1 { font-size: 22px; margin: 10px 0 2px; }
.contact-hero p { margin: 0 0 6px; color: var(--muted); }
.avatar-lg { width: 76px; height: 76px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 700; background: rgba(30,136,229,.12); color: var(--blue); }
.contact-form { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 380px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }
.card-images, .card-capture { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.card-capture { grid-template-columns: 2fr 1fr; }
.img-slot, .capture-slot {
  aspect-ratio: 1.75; border: 2px dashed var(--line); border-radius: 14px; display: grid; place-items: center; overflow: hidden;
  cursor: pointer; margin: 0; background: var(--bg); position: relative;
}
.capture-slot { background: var(--surface); }
.img-slot img, .capture-slot img { width: 100%; height: 100%; object-fit: cover; }
.img-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); text-align: center; padding: 6px; }
.img-empty i { font-size: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check input { display: none; }
.chip-check:has(input:checked) { background: var(--chip); color: #fff; border-color: var(--chip); }
.chip-add { border-style: dashed; color: var(--muted); }
.form-actions { margin-top: 14px; }

/* ---------- Scanner ---------- */
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-radius: 14px; padding: 4px; margin-bottom: 14px; }
.tab { border: 0; background: none; padding: 11px; border-radius: 11px; font: 600 14px var(--font); color: var(--muted); cursor: pointer; }
.tab.active { background: var(--navy); color: #fff; }
.qr-reader { width: 100%; min-height: 260px; background: #000; border-radius: 18px; overflow: hidden; }
.qr-reader video { border-radius: 18px; }
.scan-controls { display: flex; gap: 8px; justify-content: center; margin: 12px 0; flex-wrap: wrap; }
.scan-controls label.btn { margin: 0; color: var(--text); font-size: 15px; }
.progress { position: relative; height: 34px; background: var(--surface); border-radius: 10px; overflow: hidden; margin: 12px 0; }
.progress .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(30,136,229,.25); transition: width .2s; }
.progress span { position: relative; display: block; text-align: center; line-height: 34px; font-size: 13px; font-weight: 600; }
.raw-text { margin: 12px 0; font-size: 13px; color: var(--muted); }
.raw-text pre { white-space: pre-wrap; background: var(--surface); padding: 10px; border-radius: 10px; }
#reviewPanel { margin-top: 18px; }

/* ---------- Profile ---------- */
.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.profile-head h1 { font-size: 20px; margin: 0; }
.profile-head p { margin: 2px 0 6px; color: var(--muted); }
.avatar-xl { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; background: var(--line); }
.readonly-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 8px; font-size: 14px; }
.readonly-grid dt { color: var(--muted); }
.readonly-grid dd { margin: 0; word-break: break-word; }
.device-list { list-style: none; padding: 0; margin: 0 0 12px; }
.device-list li { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.device-list small { display: block; color: var(--muted); }
