/* ==========================================================
   مختبرات وريد الطبية — بطاقات العمل الرقمية
   ========================================================== */
:root {
  --ink: #12233D;
  --ink-2: #2A3B55;
  --vein: #B0103A;
  --teal: #0E7C86;
  --paper: #FFFFFF;
  --mist: #F2F4F7;
  --line: #DDE3EA;
  --muted: #5D6B80;
  --ok: #1E7B4A;
  --r-lg: 20px;
  --r: 12px;
  --r-sm: 8px;
  --font: "IBM Plex Sans Arabic", Tahoma, "Segoe UI", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6;
  color: var(--ink); background: var(--mist);
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
:focus-visible { outline: 3px solid rgba(14, 124, 134, .55); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ic { width: 18px; height: 18px; flex: none; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 500; font-size: 15px; line-height: 1;
  padding: 11px 18px; border-radius: var(--r-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-2); }
.btn.soft { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn.soft:hover { border-color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--paper); }
.btn.danger, .icon-btn.danger { color: var(--vein); }
.btn.big { padding: 15px 22px; font-size: 16px; width: 100%; border-radius: var(--r); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.loading::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--paper);
  color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }

/* ---------- التنبيهات ---------- */
.alert { padding: 12px 16px; border-radius: var(--r-sm); margin: 0 0 18px; font-size: 15px; border-inline-start: 4px solid; }
.alert.err { background: #FBEEF1; color: #7A0B28; border-color: var(--vein); }
.alert.ok { background: #E9F5EF; color: #135232; border-color: var(--ok); }

/* ---------- الهوية ---------- */
.brand { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 16px; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; background: var(--vein); color: #fff;
  display: grid; place-items: center; overflow: hidden; flex: none;
}
.brand-mark .vein { width: 64px; height: 30px; color: #fff; }

.topbar { background: var(--paper); border-bottom: 1px solid var(--line); padding: 14px 20px; padding-top: calc(14px + env(safe-area-inset-top)); }
.topbar .brand { max-width: 1120px; margin: 0 auto; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 20px 40px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 20px; }

.intro { max-width: 620px; margin-bottom: 26px; }
.intro h1 { font-size: clamp(26px, 5vw, 36px); font-weight: 700; margin-bottom: 8px; }
.intro p { color: var(--muted); margin: 0; font-size: 17px; }

.empty-state { text-align: center; padding: 60px 20px; max-width: 480px; margin: 0 auto; }
.empty-state h1, .empty-state h2 { font-size: 24px; margin-bottom: 8px; }
.empty-state p { color: var(--muted); }
.empty-state.small { padding: 40px 20px; background: var(--paper); border-radius: var(--r); border: 1px solid var(--line); max-width: none; }

/* ---------- نموذج البطاقة ---------- */
.builder { display: grid; gap: 28px; align-items: start; }
@media (min-width: 960px) { .builder { grid-template-columns: minmax(0, 1fr) 340px; } }
.card-form { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px 24px 24px; }
fieldset { border: 0; margin: 0; padding: 22px 0; border-bottom: 1px solid var(--line); min-width: 0; }
fieldset:last-of-type { border-bottom: 0; }
legend { font-weight: 600; font-size: 17px; padding: 0; margin-bottom: 14px; float: right; width: 100%; }
legend + * { clear: both; }
.row2 { display: grid; gap: 14px; }
@media (min-width: 620px) { .row2 { grid-template-columns: 1fr 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.short { max-width: 240px; margin-top: 16px; }
.field > span, .multi-label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.field b, .multi-label b { color: var(--vein); font-weight: 600; }
input[type=text], input[type=email], input[type=url], input[type=tel], input[type=date], input[type=password], input[type=search], select {
  font: inherit; font-size: 16px; color: var(--ink); width: 100%;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 11px 13px; min-height: 46px; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14, 124, 134, .18); }
input[dir=ltr] { text-align: left; }
input::placeholder { color: #9AA5B4; }
.has-err input, .has-err select { border-color: var(--vein); }
.f-err { color: var(--vein); font-size: 13px; margin: 2px 0 0; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 8px; cursor: pointer; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.photo-pick { display: flex; gap: 18px; align-items: center; }
.avatar {
  width: 92px; height: 92px; border-radius: 50%; flex: none;
  background: var(--mist) center / cover no-repeat; border: 1px dashed #B7C1CE;
  display: grid; place-items: center; color: var(--muted);
}
.avatar[style] { border-style: solid; border-color: var(--line); }
.avatar .ic { width: 28px; height: 28px; }
.photo-pick label.btn { cursor: pointer; }

.multi { margin-bottom: 18px; }
.multi:last-child { margin-bottom: 0; }
.multi-label { display: block; margin-bottom: 6px; }
.multi-rows { display: flex; flex-direction: column; gap: 8px; }
.mrow { display: flex; gap: 8px; align-items: center; }
.mrow > input { flex: 1; }
.mrow .del { flex: none; width: 46px; height: 46px; color: var(--muted); }
.phone-row { flex-wrap: wrap; }
.phone-row > select { width: 110px; flex: none; }
.tel-wrap { flex: 1; min-width: 200px; display: flex; direction: ltr; }
.tel-wrap select { width: 112px; flex: none; border-radius: var(--r-sm) 0 0 var(--r-sm); border-right: 0; background: var(--mist); padding-inline: 8px; }
.tel-wrap input { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.add-row {
  margin-top: 8px; background: none; border: 0; padding: 6px 0; font: inherit; font-size: 14px;
  font-weight: 500; color: var(--teal); display: inline-flex; gap: 6px; align-items: center; cursor: pointer;
}
.add-row .ic { width: 16px; height: 16px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sw {
  width: 38px; height: 38px; border-radius: 50%; background: var(--c); cursor: pointer; padding: 0;
  border: 1px solid rgba(18, 35, 61, .18); position: relative;
}
.sw.on { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.sw.custom { background: conic-gradient(#B0103A, #E0A800, #1E7B4A, #0E7C86, #1F5FAD, #4B3B8F, #B0103A); overflow: hidden; }
.sw.custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.hex { font-family: var(--font); font-size: 13px; color: var(--muted); margin-inline-start: 4px; }
.form-actions { padding-top: 22px; }

/* معاينة */
.preview { position: sticky; top: 24px; display: none; }
@media (min-width: 960px) { .preview { display: block; } }
.preview-cap { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.mini-card { background: var(--paper); border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; }
.mini-head { height: 96px; background: var(--card); color: var(--on); transition: background .25s; }
.mini-head .vein { width: 100%; height: 100%; display: block; }
.mini-avatar {
  width: 76px; height: 76px; border-radius: 50%; margin: -38px auto 0; position: relative;
  background: var(--mist) center / cover no-repeat; border: 4px solid var(--paper);
}
.mini-body { padding: 10px 22px 22px; text-align: center; }
.mini-body strong { display: block; font-size: 19px; }
.mini-body > span { display: block; color: var(--muted); font-size: 14px; }
.mini-body small { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.mini-body ul { list-style: none; padding: 14px 0 0; margin: 14px 0 0; border-top: 1px solid var(--line); text-align: right; }
.mini-body li { display: flex; gap: 10px; align-items: center; font-size: 14px; padding: 4px 0; color: var(--ink-2); overflow: hidden; }
.mini-body li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-body li .ic { color: var(--teal); width: 16px; height: 16px; }

/* ==========================================================
   صفحة البطاقة
   ========================================================== */
.page-card { background: var(--mist); }
.card-shell { max-width: 460px; margin: 0 auto; padding: 18px 14px 30px; padding-top: calc(18px + env(safe-area-inset-top)); }
.done { background: var(--paper); border: 1px solid var(--line); border-inline-start: 4px solid var(--ok); border-radius: var(--r); padding: 18px; margin-bottom: 16px; }
.done h1 { font-size: 19px; display: flex; align-items: center; gap: 8px; color: var(--ok); }
.done h1 .ic { width: 22px; height: 22px; }
.done p { margin: 6px 0 12px; color: var(--muted); font-size: 14px; }
.copy-line { display: flex; gap: 8px; }
.copy-line input { flex: 1; min-width: 0; font-size: 14px; background: var(--mist); }

.bcard { --card: #12233D; --on: #fff; background: var(--paper); border-radius: 24px; overflow: hidden; border: 1px solid var(--line); }
.bcard-head { position: relative; height: 150px; background: var(--card); color: var(--on); }
.bcard-head .vein { position: absolute; inset: 0; width: 100%; height: 100%; }
.bcard-brand { position: absolute; top: 16px; right: 20px; font-size: 13px; font-weight: 500; opacity: .85; }
.bcard-id { text-align: center; padding: 0 22px 6px; }
.bcard-photo {
  width: 116px; height: 116px; border-radius: 50%; margin: -58px auto 14px; position: relative;
  background: var(--mist) center / cover no-repeat; border: 5px solid var(--paper);
  display: grid; place-items: center; font-size: 36px; font-weight: 600; color: var(--ink);
}
.bcard-photo:not([style]) { background: #E8ECF2; }
.bcard-name { font-size: 27px; font-weight: 700; letter-spacing: 0; }
.bcard-title { margin: 4px 0 0; color: var(--muted); font-size: 16px; }
.bcard-company { margin: 2px 0 0; color: var(--ink-2); font-size: 15px; font-weight: 500; }

.bcard-actions { padding: 20px 22px 6px; display: grid; gap: 10px; }
.bcard-actions .btn.primary { background: var(--vein); }
.bcard-actions .btn.primary:hover { background: #950D31; }
.act-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.act-row .btn { flex-direction: column; gap: 6px; padding: 12px 6px; font-size: 13px; }
.act-row .ic { width: 20px; height: 20px; color: var(--teal); }

.bcard-list { list-style: none; margin: 0; padding: 10px 22px; }
.bcard-list li { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.bcard-list li:last-child { border-bottom: 0; }
.li-ic {
  width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: #E7F2F3; color: var(--teal);
}
.li-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.li-body small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.li-body a, .li-body > span { color: var(--ink); font-weight: 500; font-size: 16px; overflow-wrap: anywhere; }
.li-body a[dir=ltr] { text-align: right; unicode-bidi: plaintext; }
.li-side { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); color: var(--ok); }
.li-side.txt { width: auto; padding: 0 14px; border-radius: 20px; font-size: 13px; color: var(--teal); font-weight: 500; }

.bcard-qr {
  display: flex; align-items: center; gap: 18px; margin: 6px 22px 22px; padding: 18px;
  border-radius: 16px; background: var(--mist);
}
.qr-box { width: 132px; height: 132px; flex: none; background: #fff; border-radius: 10px; padding: 8px; }
.qr-box img, .qr-box canvas { width: 100% !important; height: 100% !important; display: block; }
.qr-text { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.qr-text strong { font-size: 16px; }
.qr-text span { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.qr-dl { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--paper); font-size: 13px; }
.qr-dl span { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; color: var(--muted); border-left: 1px solid var(--line); white-space: nowrap; }
.qr-dl .ic { width: 16px; height: 16px; }
.qr-dl button { font: inherit; font-weight: 600; font-size: 13px; color: var(--ink); background: none; border: 0; padding: 9px 12px; cursor: pointer; }
.qr-dl button + button { border-right: 1px solid var(--line); }
.qr-dl button:hover { background: var(--mist); color: var(--teal); }
.meta-qr .qr-dl { margin-top: 10px; }
.shell-foot { text-align: center; font-size: 14px; margin-top: 18px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 30px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================
   الدخول والتثبيت
   ========================================================== */
.page-login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--ink); }
.login-box { width: 100%; max-width: 400px; background: var(--paper); border-radius: var(--r-lg); padding: 28px; }
.login-box .brand { margin-bottom: 22px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ==========================================================
   لوحة التحكم
   ========================================================== */
.adm { display: flex; min-height: 100vh; }
.adm-side {
  width: 250px; flex: none; background: var(--ink); color: #fff; padding: 22px 14px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.adm-side .brand { padding: 0 8px 22px; }
.adm-side .brand small { color: #9FB0C6; }
.adm-side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.adm-side nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #C7D2E0; font-size: 15px; text-decoration: none; }
.adm-side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.adm-side nav a.on { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset -3px 0 0 var(--vein); }
.adm-user { border-top: 1px solid rgba(255, 255, 255, .12); padding: 14px 8px 0; display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.adm-user a { color: #C7D2E0; display: flex; gap: 6px; align-items: center; }
.adm-main { flex: 1; min-width: 0; }
.adm-top { display: flex; align-items: center; gap: 12px; padding: 18px 28px; background: var(--paper); border-bottom: 1px solid var(--line); }
.adm-top h1 { font-size: 20px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#menuBtn { display: none; }
.adm-content { padding: 24px 28px 48px; max-width: 1200px; }

@media (max-width: 900px) {
  .adm-side { position: fixed; inset: 0 0 0 auto; z-index: 40; transform: translateX(100%); transition: transform .25s; }
  .nav-open .adm-side { transform: none; box-shadow: -20px 0 60px rgba(0, 0, 0, .3); }
  #menuBtn { display: inline-grid; }
  .adm-top { padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); position: sticky; top: 0; z-index: 30; }
  .adm-content { padding: 16px 14px 40px; }
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; display: flex; flex-direction: column; }
.stat span { font-size: 14px; color: var(--muted); }
.stat strong { font-size: 34px; font-weight: 700; line-height: 1.2; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.stat small { font-size: 13px; color: var(--muted); }
.stat.lead { background: var(--ink); color: #fff; border-color: var(--ink); }
.stat.lead span, .stat.lead small { color: #B5C3D6; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 20px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; gap: 10px; }
.panel-head h2 { font-size: 17px; font-weight: 600; }
.panel-head a { font-size: 14px; }
.chart-box { position: relative; height: 280px; }
.grid2 { display: grid; gap: 20px; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.grid2 > .panel { margin-bottom: 0; }
.grid2 + .panel, .grid2 { margin-bottom: 20px; }
.stack-panels { display: flex; flex-direction: column; gap: 20px; }
.stack-panels .panel { margin: 0; }

.bars { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bars li { display: grid; grid-template-columns: 110px 1fr 36px; gap: 10px; align-items: center; font-size: 14px; }
.bars i { height: 10px; border-radius: 5px; background: linear-gradient(to left, var(--teal) var(--w), var(--mist) var(--w)); }
.bars b { text-align: left; font-variant-numeric: tabular-nums; }

.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
@media (min-width: 700px) { .people { grid-template-columns: 1fr 1fr; } }
.people a { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.people a:hover { background: var(--mist); }
.people strong { display: block; font-size: 15px; }
.people small { display: block; font-size: 13px; color: var(--muted); }
.people time { margin-inline-start: auto; font-size: 12px; color: var(--muted); }
.p-av {
  width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--mist) center / cover no-repeat;
  display: grid; place-items: center; font-weight: 600; color: var(--ink-2);
}

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; align-items: center; }
.filters select { width: auto; min-width: 130px; }
.filters .end { margin-inline-start: auto; }
.search { position: relative; flex: 1 1 260px; }
.search .ic { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-right: 40px; }
.result-count { font-size: 14px; color: var(--muted); margin: 0 0 10px; }

.tbl-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: right; font-weight: 500; color: var(--muted); font-size: 13px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #FAFBFC; white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td small { display: block; color: var(--muted); font-size: 12px; }
.tbl .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl.compact td, .tbl.compact th { padding: 10px 8px; }
.who { display: flex; align-items: center; gap: 10px; }
.who a { color: var(--ink); }
.acts { white-space: nowrap; }
.acts form { display: inline; margin: 0; }
.acts .icon-btn { width: 34px; height: 34px; }
.acts .ic { width: 16px; height: 16px; }
.pill { display: inline-block; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 20px; }
.pill.on { background: #E6F4EC; color: var(--ok); }
.pill.off { background: #FBEEF1; color: var(--vein); }

@media (max-width: 760px) {
  .tbl-wrap { background: none; border: 0; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; padding: 6px 14px; }
  .tbl td { border: 0; padding: 6px 0; display: flex; justify-content: space-between; gap: 10px; }
  .tbl td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: 13px; }
  .tbl td[data-l="الموظف"]::before { display: none; }
  .tbl td.acts { justify-content: flex-start; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
  .filters .end { margin-inline-start: 0; }
  .filters select { flex: 1; }
}

.pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 18px 0; }
.pager a, .pager span { min-width: 40px; height: 40px; padding: 0 12px; display: inline-grid; place-items: center; border-radius: var(--r-sm); font-size: 14px; }
.pager a { background: var(--paper); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.pager a:hover { border-color: var(--ink); }
.pager .cur { background: var(--ink); color: #fff; }
.pager .off { color: #A9B3C1; }
.pager .gap { min-width: 20px; padding: 0; }

.card-meta { display: flex; flex-direction: column; gap: 16px; }
.meta-qr { display: flex; gap: 18px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.meta-qr .qr-box { width: 120px; height: 120px; border: 1px solid var(--line); }
.meta-qr p { margin: 4px 0 10px; }
.meta-qr > div:last-child { flex: 1; min-width: 0; }
.card-meta:has(.meta-qr:only-child) .meta-qr { padding-bottom: 0; border-bottom: 0; }
@media (max-width: 520px) { .meta-qr { flex-direction: column; text-align: center; } }
.meta-link { display: flex; gap: 8px; flex-wrap: wrap; }
.meta-link input { flex: 1 1 260px; background: var(--mist); font-size: 14px; }
.meta-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 0; }
.meta-stats dt { font-size: 12px; color: var(--muted); }
.meta-stats dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.meta-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-acts form { margin: 0; }
.page-admin .card-form { border-radius: var(--r); }

@media (max-width: 420px) {
  .card-form { padding: 4px 16px 18px; }
  .wrap { padding: 20px 14px 32px; }
  .photo-pick { align-items: flex-start; }
  .bcard-qr { flex-direction: column; text-align: center; }
  .qr-text { align-items: center; }
  .bcard-name { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
