:root {
  --bg: #0b0d12;
  --bg-2: #11141b;
  --bg-3: #171b24;
  --border: #232936;
  --border-2: #2e3646;
  --text: #e7eaf0;
  --text-2: #9aa3b2;
  --text-3: #667085;
  --accent: #6c7cff;
  --accent-2: #8b98ff;
  --red: #ef4444;
  --orange: #f97316;
  --yellow: #eab308;
  --green: #22c55e;
  --radius: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; padding: 20px 14px;
  background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.logo .mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), #b16cff); display: grid; place-items: center; font-size: 13px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 8px; color: var(--text-2); font-weight: 500;
  border: none; background: none; width: 100%; text-align: left; font-size: 13.5px;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active { background: var(--bg-3); color: var(--text); }
.nav-item .ic { display: grid; place-items: center; color: var(--text-3); }
.nav-item:hover .ic, .nav-item.active .ic { color: var(--accent-2); }
.nav-item .badge { margin-left: auto; }
.sidebar .spacer { flex: 1; }
.userbox {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 6px 2px; border-top: 1px solid var(--border);
}
.userbox .avatar {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #b16cff);
  display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff;
}
.userbox .uinfo { flex: 1; min-width: 0; }
.userbox .uinfo b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbox .uinfo span { display: block; color: var(--text-3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn {
  display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0;
  background: none; border: none; border-radius: 8px; color: var(--text-3); transition: .15s;
}
.iconbtn:hover { background: var(--bg-3); color: var(--text); }
.iconbtn.active { background: var(--bg-3); color: var(--accent-2); }

.main { flex: 1; padding: 28px 36px 60px; max-width: 1280px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; letter-spacing: -.02em; font-weight: 700; }
.page-head p { color: var(--text-2); margin-top: 4px; font-size: 13px; }

/* ---------- components ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent); color: #fff; border: none;
  padding: 8px 15px; border-radius: 8px; font-weight: 600; font-size: 13.5px;
  transition: .15s;
}
.btn:hover { background: var(--accent-2); }
.btn.secondary { background: var(--bg-3); color: var(--text); border: 1px solid var(--border-2); }
.btn.secondary:hover { border-color: var(--text-3); }
.btn.ghost { background: none; color: var(--text-2); border: none; padding: 6px 10px; }
.btn.ghost:hover { color: var(--text); }
.btn.danger { background: rgba(239,68,68,.12); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.btn:disabled { opacity: .5; cursor: default; }

.card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.grid { display: grid; gap: 14px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1000px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }

.stat .label { color: var(--text-2); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; }
.stat .sub { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.stat.warn .value { color: var(--yellow); }
.stat.bad .value { color: var(--red); }
.stat.good .value { color: var(--green); }

.statrow { display: flex; gap: 40px; flex-wrap: wrap; }
.statrow .stat { min-width: 130px; }
.statrow .codebar { margin-top: 10px; }

.attention { margin-top: 14px; }
.attention .label { color: var(--text-2); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.attention ul { list-style: none; }
.attention li { padding: 4px 0; font-size: 13.5px; }

.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; gap: 5px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600;
}
.badge.red { background: rgba(239,68,68,.14); color: #f87171; }
.badge.orange { background: rgba(249,115,22,.14); color: #fb923c; }
.badge.yellow { background: rgba(234,179,8,.14); color: #facc15; }
.badge.green { background: rgba(34,197,94,.14); color: #4ade80; }
.badge.grey { background: var(--bg-3); color: var(--text-2); }
.badge.violet { background: rgba(108,124,255,.14); color: var(--accent-2); }

/* ---------- dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--border-2); border-radius: 14px;
  padding: 46px 30px; text-align: center; transition: .2s; cursor: pointer;
  background: var(--bg-2);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: rgba(108,124,255,.05); }
.dropzone .icon { font-size: 34px; margin-bottom: 12px; }
.dropzone h3 { font-size: 16px; margin-bottom: 6px; }
.dropzone p { color: var(--text-2); font-size: 13px; }
.dz-actions { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.upload-location {
  min-width: 180px; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: 8px; font: inherit; font-size: 13px;
}

.upload-summary {
  margin: 18px 2px 8px; color: var(--text-2); font-size: 12.5px; font-weight: 600;
}
.joblist {
  display: flex; flex-direction: column; gap: 8px;
  max-height: min(50vh, 480px); overflow-y: auto; padding-right: 4px;
}
.joblist:empty { display: none; }
.jobrow {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
}
.jobrow .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jobrow .detail { color: var(--text-3); font-size: 12px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jobmark { width: 14px; flex: 0 0 14px; text-align: center; font-weight: 700; }
.jobmark.ok { color: var(--green); }
.jobmark.err { color: var(--red); }
.spinner {
  width: 14px; height: 14px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid var(--border-2); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- table ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.search {
  flex: 1; min-width: 220px; max-width: 380px;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  padding: 8px 13px; border-radius: 8px; font: inherit; font-size: 13.5px;
}
.search:focus { outline: none; border-color: var(--accent); }

table.reg { width: 100%; border-collapse: collapse; }
.reg th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.reg td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.reg tr.row { cursor: pointer; transition: background .1s; }
.reg tr.row:hover { background: var(--bg-2); }
.thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; background: var(--bg-3); display: grid; place-items: center; color: var(--text-3); font-size: 15px; flex-shrink: 0; }
.mreg-thumb {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-3);
}
.mreg-thumb::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .14);
  border-top-color: rgba(255, 255, 255, .52);
  opacity: .9;
  animation: spin .85s linear infinite;
  transition: opacity .16s ease;
}
.mreg-thumb.is-loaded::after { opacity: 0; }
.mreg-thumb .thumb {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  display: block;
}
.js-thumb-loading {
  background: var(--bg-3);
}
.mreg-thumb .js-thumb-loading {
  background: var(--bg-3);
  animation: none;
}
.js-thumb-loading.loaded {
  animation: none;
  background: var(--bg-3);
}
.namecell { display: flex; align-items: center; gap: 12px; }
.namecell .nm { font-weight: 600; }
.namecell .sub { color: var(--text-3); font-size: 12px; margin-top: 1px; }
.reg-row-actions { display: inline-flex; align-items: center; gap: 8px; }
.reg-archive-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-3);
}
.reg-archive-btn.archive:hover { color: #f87171; border-color: rgba(239, 68, 68, .4); }
.reg-archive-btn.restore:hover { color: var(--accent-2); border-color: rgba(139, 152, 255, .4); }

/* ---------- drawer (desktop: centered modal / mobile: full-screen sheet) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); z-index: 40; }
.drawer {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(1320px, calc(100vw - 48px)); max-height: min(900px, calc(100dvh - 48px)); z-index: 50;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  overflow: hidden; padding: 22px 28px 24px;
  animation: popin .18s cubic-bezier(.2,.8,.2,1);
}
@keyframes popin { from { transform: translate(-50%, -48%) scale(.97); opacity: 0; } }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
.confirm-box {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(480px, 92vw); z-index: 81;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  padding: 22px 24px; animation: popin .18s cubic-bezier(.2,.8,.2,1);
}
.confirm-box h3 { font-size: 16px; letter-spacing: -.01em; margin-bottom: 8px; }
.confirm-box p { color: var(--text-2); font-size: 13px; line-height: 1.55; }
.confirm-box .actions { display: flex; gap: 10px; margin-top: 18px; align-items: center; flex-wrap: wrap; }

/* subtle photo swap tools + gallery picker */
.photo-tools { display: flex; gap: 10px; justify-content: center; margin-top: 8px; }
.linkbtn { background: none; border: none; color: var(--text-3); font-size: 12px; padding: 0; }
.linkbtn:hover { color: var(--accent-2); text-decoration: underline; }
.photo-upload-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px;
  background: var(--bg-3); border: 1px solid var(--border-2); border-radius: 8px;
  color: var(--text-2); font-weight: 700; line-height: 1;
}
.photo-upload-btn:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }
.photo-upload-btn svg { width: 15px; height: 15px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px; margin-top: 14px; max-height: 320px; overflow-y: auto; }
.photo-grid button { background: var(--bg-3); border: 1px solid var(--border); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.photo-grid button:hover { border-color: var(--accent); }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.photo-grid .lbl { font-size: 10.5px; color: var(--text-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer h2 { font-size: 19px; letter-spacing: -.02em; margin-bottom: 2px; }
.drawer .close { position: absolute; top: 18px; right: 20px; }
.drawer-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-right: 48px; }
.drawer-submeta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 7px; }
.drawer-submeta .badge,
.wiz-badges .badge {
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .015em;
}
.register-state { flex-shrink: 0; color: var(--green); font-size: 12px; font-weight: 700; margin-top: 3px; }
.register-state.archived { color: var(--text-3); }
.media-panel { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px; min-height: 360px; display: grid; place-items: center; }
.media-col { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.media-col .media-panel { flex: 1; min-height: 240px; position: relative; overflow: hidden; }
.media-col .hero-img { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); max-height: none; object-fit: contain; }
.fieldgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 14px; margin-top: 12px; align-items: start; }
.fieldgrid .wide { grid-column: 1 / -1; }
.fieldgrid .textblock { grid-column: auto; }
.fieldgrid .wide.textblock { grid-column: 1 / -1; }
.field label { display: block; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 5px; }
.field.missing label { color: var(--text-3); }
.field.missing label::after { content: ""; display: inline-block; width: 5px; height: 5px; margin-left: 7px; border-radius: 50%; background: rgba(250,204,21,.85); vertical-align: 2px; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 8px 11px; border-radius: 8px; font: inherit; font-size: 13.5px;
}
.field select option { background: var(--bg); color: var(--text); }
.field.missing input, .field.missing textarea, .field.missing select { border-color: rgba(250,204,21,.38); background: var(--bg); }
.field.missing select option { background: var(--bg); color: var(--text); }
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field.missing input::placeholder, .field.missing textarea::placeholder { color: var(--text-3); opacity: 1; }
.field textarea { min-height: 42px; max-height: 118px; resize: vertical; overflow: hidden; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.reviewbox { margin-top: 16px; background: rgba(234,179,8,.07); border: 1px solid rgba(234,179,8,.25); border-radius: 8px; padding: 12px 14px; font-size: 13px; }
.reviewbox li { margin-left: 18px; margin-top: 3px; color: #facc15; }
.hero-img { display: block; width: 100%; max-width: 100%; max-height: 420px; object-fit: contain; border-radius: 8px; }

/* ---------- review wizard ---------- */
.drawer.wizard { display: flex; flex-direction: column; height: min(900px, calc(100dvh - 48px)); }
.drawer.register-edit {
  width: min(1520px, calc(100vw - 24px));
  height: min(940px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  padding: 22px 26px 18px;
}
.drawer.register-edit .drawer-title-row { align-items: center; }
.drawer.register-edit .wiz-body { overflow-y: auto; margin-top: 14px; padding-right: 2px; }
.drawer.register-edit .wiz-footer { margin-top: 10px; padding-top: 10px; }
.wiz-badges { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.wsteps { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.register-tabs {
  display: inline-flex; width: max-content; max-width: 100%; gap: 3px; margin-top: 12px; padding: 4px;
  background: #090b10; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}
.register-tabs button {
  border: none; background: transparent; color: var(--text-3);
  padding: 8px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 700;
}
.register-tabs button.active { background: var(--bg-3); color: var(--text); box-shadow: 0 1px 8px rgba(0,0,0,.22); }
.wstep-tab {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text-2);
  padding: 6px 12px 6px 7px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.wstep-tab i {
  font-style: normal; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 700;
  background: var(--bg-2); color: var(--text-3);
}
.wstep-tab.active { border-color: var(--accent); color: var(--text); }
.wstep-tab.active i { background: rgba(108,124,255,.16); color: var(--accent-2); }
.wstep-tab.done i { background: rgba(34,197,94,.14); color: var(--green); }
.wiz-body { flex: 1; min-height: 200px; overflow-y: auto; margin-top: 14px; }
.wstep { display: none; }
.wstep.active { display: block; }
.wiz-cols { display: grid; grid-template-columns: minmax(220px, 32%) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.wiz-footer { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.ai-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ai-item { position: relative; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px 10px; }
.ai-item dt { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding-right: 64px; }
.ai-item dd { font-size: 13px; margin-top: 3px; overflow-wrap: anywhere; }
.summary-shell { display: grid; gap: 12px; }
.summary-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 16px; background: linear-gradient(180deg, rgba(108,124,255,.08), rgba(108,124,255,.03));
  border: 1px solid rgba(108,124,255,.2); border-radius: 12px;
}
.summary-kicker {
  display: block; color: var(--accent-2); font-size: 10px; text-transform: uppercase;
  letter-spacing: .06em; font-weight: 800; margin-bottom: 4px;
}
.summary-head h3 { font-size: 16px; letter-spacing: -.02em; }
.summary-head p { color: var(--text-2); font-size: 12.5px; line-height: 1.45; margin-top: 4px; }
.summary-chip {
  flex-shrink: 0; align-self: center; padding: 7px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .03em; white-space: nowrap;
  background: var(--bg-3); color: var(--text-2); border: 1px solid var(--border-2);
}
.summary-chip.good { background: rgba(34,197,94,.12); color: var(--green); border-color: rgba(34,197,94,.22); }
.summary-chip.warn { background: rgba(234,179,8,.12); color: #facc15; border-color: rgba(234,179,8,.24); }
.summary-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.summary-grid .ai-item { background: var(--bg-2); }
.summary-issues { margin-top: 2px; }
.conf { position: absolute; top: 8px; right: 10px; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.conf.hi { background: rgba(34,197,94,.14); color: var(--green); }
.conf.mid { background: rgba(234,179,8,.14); color: #facc15; }
.conf.lo { background: rgba(239,68,68,.14); color: #f87171; }
.conf.none { background: var(--bg-3); color: var(--text-3); }
.fold { margin-top: 16px; }
.fold summary { cursor: pointer; color: var(--text-3); font-size: 12.5px; font-weight: 600; margin-bottom: 12px; }
.fold summary:hover { color: var(--accent-2); }
.sds-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin: 0 0 14px;
}
.sds-card b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.sds-card span { display: block; color: var(--text-3); font-size: 12px; }
.sds-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.sds-viewer {
  position: fixed; inset: 28px; z-index: 71;
  display: flex; flex-direction: column; min-height: 0;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  padding: 14px; animation: popin .18s cubic-bezier(.2,.8,.2,1);
}
.sds-viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.sds-viewer-head h3 { font-size: 15px; letter-spacing: -.01em; }
.pdf-frame { width: 100%; flex: 1; min-height: 0; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.attest-row {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 14px;
  padding: 12px 14px; background: rgba(234,179,8,.07); border: 1px solid rgba(234,179,8,.25);
  border-radius: 10px; font-size: 13px; line-height: 1.5; cursor: pointer;
}
.attest-row input { margin-top: 3px; flex-shrink: 0; }
.register-edit-layout { display: grid; gap: 14px; min-height: 0; }
.register-edit-top {
  display: grid; grid-template-columns: minmax(260px, 300px) minmax(0, 1fr); gap: 18px; align-items: stretch;
  background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.008));
  border: 1px solid var(--border); border-radius: 12px; padding: 16px;
}
.register-edit-main { min-width: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.register-edit-fields { margin-top: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.register-edit-primary { grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; }
.register-edit-primary .wide { grid-column: 1 / -1; }
.register-edit-details { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.register-edit-details .wide { grid-column: auto; }
.register-edit-details .wide.textblock { grid-column: auto; }
.register-edit-details .field:nth-child(1) { grid-column: span 4; }
.register-edit-details .field:nth-child(2) { grid-column: span 8; }
.register-edit-details .field:nth-child(3),
.register-edit-details .field:nth-child(4) { grid-column: span 6; }
.register-edit-details .field:nth-child(5) { grid-column: 1 / -1; }
.register-edit-details .field textarea { min-height: 104px; max-height: 148px; line-height: 1.35; }
.register-edit-details .field input { min-height: 40px; }
.register-edit-photo { display: flex; flex-direction: column; margin-bottom: 0; min-width: 0; position: relative; }
.register-edit-photo .media-panel {
  flex: 1; display: grid; min-height: 260px; max-width: 100%; padding: 8px;
  background: radial-gradient(circle at 50% 20%, rgba(108,124,255,.10), transparent 42%), var(--bg);
}
.register-edit-photo .hero-img { width: 100%; height: 100%; max-width: none; max-height: 320px; object-fit: cover; }
.register-edit-photo .photo-tools { position: absolute; top: 10px; right: 10px; justify-content: flex-end; margin-top: 0; }
.register-edit-photo .photo-upload-btn {
  width: 34px; height: 34px; justify-content: center; padding: 0;
  color: #fff; background: rgba(9,11,16,.78); border-color: rgba(255,255,255,.18);
  box-shadow: 0 8px 22px rgba(0,0,0,.28); backdrop-filter: blur(10px);
}
.register-edit-photo .photo-upload-btn:hover { background: rgba(23,27,36,.92); border-color: var(--accent-2); }
.register-edit-photo .photo-upload-btn span { display: none; }
.register-edit-photo.empty-photo { display: flex; justify-content: flex-start; margin-bottom: 0; min-height: 130px; }
.register-edit-photo.empty-photo .photo-tools { position: static; justify-content: flex-start; margin-top: 0; }
.register-edit-photo.empty-photo .photo-upload-btn { width: auto; height: auto; padding: 9px 12px; color: var(--text); background: var(--bg-3); border-color: var(--border-2); box-shadow: none; backdrop-filter: none; }
.register-edit-photo.empty-photo .photo-upload-btn span { display: inline; }
.register-panel { display: none; height: 100%; min-height: 0; }
.register-panel.active { display: block; }
.register-panel[data-register-panel="info"].active { height: auto; }
.register-panel[data-register-panel="sds"].active { display: flex; flex-direction: column; }
.register-sds-frame { min-height: 0; height: 100%; }

@media (max-width: 980px) {
  .drawer.register-edit { width: min(920px, calc(100vw - 24px)); }
  .register-edit-top { grid-template-columns: minmax(240px, 280px) minmax(0, 1fr); gap: 14px; padding: 14px; }
  .register-edit-main { padding: 14px; }
  .register-edit-primary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .register-edit-details { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .register-edit-details .field:nth-child(1),
  .register-edit-details .field:nth-child(2),
  .register-edit-details .field:nth-child(3),
  .register-edit-details .field:nth-child(4) { grid-column: auto; }
  .register-edit-details .field textarea { min-height: 84px; max-height: 122px; }
  .register-edit-details .field:last-child { grid-column: 1 / -1; }
}

/* ---------- auth ---------- */
/* body.auth: size to the visual viewport exactly — no page scroll, no jump when
   the on-screen keyboard opens (100dvh + interactive-widget=resizes-content). */
body.auth { height: 100dvh; overflow: hidden; overscroll-behavior: none; }
body.auth #app { height: 100%; }
.auth-wrap { height: 100%; min-height: 0; display: grid; grid-template-columns: 100%; place-items: center; padding: 20px; overflow-y: auto; }
.auth-card { width: 400px; max-width: 100%; }
.auth-card .card { padding: 34px; }
.auth-card h1 { font-size: 22px; margin: 18px 0 4px; letter-spacing: -.02em; }
.auth-card .sub { color: var(--text-2); margin-bottom: 22px; font-size: 13.5px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 10px; margin-top: 6px; }
.auth-submit { position: relative; min-height: 42px; overflow: hidden; transition: transform .14s ease, filter .18s ease, opacity .18s ease; }
.auth-submit:active { transform: translateY(1px) scale(.995); }
.auth-submit:disabled { cursor: wait; opacity: .92; }
.auth-submit.is-loading { cursor: wait; opacity: .92; pointer-events: none; }
.auth-submit-label { transition: transform .12s ease, opacity .12s ease; }
.auth-submit-spinner {
  position: absolute; left: 50%; top: 50%; margin-left: -8.5px; margin-top: -8.5px;
  width: 17px; height: 17px; border-radius: 50%; opacity: 0; transform: translateY(4px) scale(.88);
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: spin .68s linear infinite; transition: transform .12s ease, opacity .12s ease;
  pointer-events: none;
}
.auth-submit.is-loading .auth-submit-label { opacity: 0; transform: translateY(-5px) scale(.97); }
.auth-submit.is-loading .auth-submit-spinner { opacity: 1; transform: translateY(0) scale(1); }
.auth-submit.is-loading .auth-submit-label { pointer-events: none; }
.auth-submit.is-loading .auth-submit-spinner { z-index: 1; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--text-2); font-size: 13px; }
.auth-card input:-webkit-autofill,
.auth-card input:-webkit-autofill:hover,
.auth-card input:-webkit-autofill:focus,
.auth-card input:autofill {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow: 0 0 0 1000px var(--bg) inset;
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  transition: background-color 9999s ease-in-out 0s, color 9999s ease-in-out 0s;
}

/* ---------- misc ---------- */
#toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 9px;
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 255, 255, .22), transparent 42%),
    linear-gradient(135deg, #6c7cff, #9d6bff);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .28);
  padding: 10px 16px 10px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1.35;
  box-shadow: 0 10px 28px rgba(108, 124, 255, .45), 0 2px 8px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
  animation: toast-in .22s cubic-bezier(.34, 1.4, .64, 1);
}
.toast::before {
  content: ""; width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%;
  background: #fff; box-shadow: 0 0 8px rgba(255, 255, 255, .9);
}
.toast.hide { animation: toast-out .15s ease forwards; }
.toast.err {
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 255, 255, .2), transparent 42%),
    linear-gradient(135deg, #f43f5e, #fb7185);
  border-color: rgba(255, 255, 255, .3);
  box-shadow: 0 10px 28px rgba(244, 63, 94, .42), 0 2px 8px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .28);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(.94); } }
.empty { text-align: center; color: var(--text-3); padding: 60px 20px; }
.empty .big { font-size: 36px; margin-bottom: 12px; }
.imgcard { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; }
.imgcard img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; }
.imgcard select { flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 7px 10px; border-radius: 8px; }
.section-title { font-size: 15px; font-weight: 700; margin: 26px 0 12px; letter-spacing: -.01em; }
.section-hint { color: var(--text-3); font-size: 12.5px; margin: -6px 0 14px; }
.reviewcard { margin-bottom: 12px; cursor: pointer; transition: border-color .15s, transform .15s; }
.reviewcard:hover { border-color: var(--accent); transform: translateY(-1px); }
.queue-hint { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }

/* ---------- add & review flow ---------- */
.allclear {
  display: flex; align-items: center; gap: 14px; margin-top: 22px;
  padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-2); font-size: 13.5px;
}
.allclear .tick {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%;
  display: grid; place-items: center; font-size: 15px; font-weight: 700;
  background: rgba(34,197,94,.14); color: var(--green);
}
.allclear b { display: block; margin-bottom: 2px; }
.allclear .sub { color: var(--text-3); font-size: 12.5px; }
.codebar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.progressbar { height: 6px; border-radius: 4px; background: var(--bg-3); overflow: hidden; margin-top: 10px; }
.progressbar > div { height: 100%; background: linear-gradient(90deg, var(--accent), #b16cff); transition: width .4s; }

.dz-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

/* ---------- mobile ---------- */
.mobilebar { display: none; }
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .mobilebar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: var(--bg-2); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
  }
  .mobilebar .logo { padding: 0; }
  /* sidebar becomes a fixed bottom tab bar */
  .review-queue-page {
    --review-sticky-top: 0px;
  }
  #mobileReview .review-queue-page {
    --review-sticky-top: 56px;
  }
  .review-queue-page .mreview-sticky {
    position: sticky;
    top: var(--review-sticky-top);
    z-index: 7;
    background: var(--bg);
    margin-bottom: 10px;
  }
  .mphoto-page.review-queue-page .mreview-head {
    position: static;
    margin: 4px 0 0;
    padding: 4px 0 0;
  }
  .mphoto-page.review-queue-page .mphoto-section {
    margin-top: 0;
  }
  .mphoto-page.review-queue-page .mphoto-section h3 {
    position: static;
    top: auto;
    margin: 0;
    padding: 6px 0 8px;
    background: transparent;
  }
  #mobileReview .review-queue-page .mreview-head {
    top: auto;
  }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; height: auto; flex-direction: row; gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: none; border-top: 1px solid var(--border); z-index: 30;
  }
  .sidebar .logo, .sidebar .userbox, .sidebar .spacer { display: none; }
  .nav-item { justify-content: center; text-align: center; font-size: 12.5px; padding: 10px 4px; }
  .nav-item .badge { margin-left: 4px; }

  .main { padding: 18px 14px calc(88px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 19px; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .statrow { gap: 20px; }

  .dropzone { padding: 28px 16px; }
  .jobrow .detail { max-width: 30%; }
  .reviewcard > div, .imgcard { flex-wrap: wrap; }

  .drawer {
    inset: 0; transform: none; width: 100vw; height: 100dvh;
    max-height: none; border-radius: 0; border: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 16px 12px calc(8px + env(safe-area-inset-bottom));
    animation: slidein .22s cubic-bezier(.2,.8,.2,1);
  }
  .drawer.register-edit {
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .drawer .close {
    position: fixed;
    top: calc(8px + env(safe-area-inset-top));
    right: 10px;
    z-index: 82;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    color: #fff;
    background: rgba(9, 11, 16, .78);
    border: 1px solid rgba(255, 255, 255, .22);
    backdrop-filter: blur(8px);
  }
  .drawer-title-row { padding-right: 44px; }
  .drawer.wizard { height: 100%; }
  .wiz-cols { display: block; }
  .register-edit-top {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
    align-items: start;
  }
  .register-edit-main { padding: 10px; }
  .register-edit-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
  .register-edit-fields .wide,
  .register-edit-fields .wide.textblock { grid-column: 1 / -1; }
  .sds-card { align-items: flex-start; flex-direction: column; }
  .sds-actions { width: 100%; justify-content: space-between; }
  .sds-viewer { inset: 0; border-radius: 0; border: none; padding: 12px; }
  .wiz-cols .media-col { margin-bottom: 14px; }
  .drawer.wizard .wiz-body { overflow-y: auto; min-height: 0; }
  .drawer.register-edit .wiz-body {
    flex: 0 0 auto;
    overflow: visible;
    min-height: 0;
  }
  .summary-head { flex-direction: column; align-items: flex-start; }
  .summary-chip { align-self: flex-start; }
  .summary-grid { grid-template-columns: 1fr; }
  .media-panel { min-height: 0; margin-bottom: 14px; }
  .media-col { margin-bottom: 14px; gap: 8px; }
  .media-col .media-panel { margin-bottom: 0; flex: none; min-height: 0; position: static; }
  .media-col .hero-img { position: static; width: 100%; height: auto; max-height: 180px; }
  .hero-img { max-height: 180px; }
  .drawer.register-edit .register-edit-photo .media-panel {
    min-height: 132px;
    max-height: 148px;
    aspect-ratio: auto;
    padding: 6px;
  }
  .drawer.register-edit .register-edit-photo .hero-img {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
  }
  .field textarea { min-height: 44px; max-height: 140px; }
  .fieldgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fieldgrid .wide { grid-column: 1 / -1; }
  .fieldgrid .textblock { grid-column: 1 / -1; }
  .wiz-footer {
    gap: 8px;
    position: sticky;
    bottom: 0;
    margin-top: 8px;
    padding-top: 10px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--bg-2) 72%, rgba(17, 20, 27, .72));
    backdrop-filter: blur(4px);
    z-index: 2;
  }
  .wiz-footer .btn { flex: 1 1 calc(50% - 4px); }

  /* register table: keep thumb, name, storage, status; rest scrolls off less usefully on a phone */
  .reg th:nth-child(3), .reg td:nth-child(3),
  .reg th:nth-child(4), .reg td:nth-child(4),
  .reg th:nth-child(6), .reg td:nth-child(6),
  .reg th:nth-child(7), .reg td:nth-child(7) { display: none; }

  /* 16px inputs prevent iOS auto-zoom on focus */
  .field input, .field textarea, .field select, .search, .imgcard select { font-size: 16px; }
  .btn { padding: 10px 16px; }

  #toasts { left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); align-items: center; }

  /* top-anchor the auth card so the keyboard resize doesn't re-centre (jump) it */
  .auth-wrap { place-items: start center; padding-top: max(40px, 8svh); }
  .auth-card .card { padding: 26px 22px; }
}

@media (max-width: 420px) {
  .register-edit-top { grid-template-columns: 116px minmax(0, 1fr); gap: 8px; }
  .drawer.register-edit .register-edit-photo .media-panel { min-height: 116px; max-height: 132px; }
  .register-edit-fields,
  .fieldgrid { grid-template-columns: 1fr; }
  .wiz-footer .btn { flex: 1 1 100%; }
}

/* ---------- mobile register ---------- */
.mregcard {
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: 9px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 11px 12px;
  transition: transform .11s ease, border-color .14s ease, background-color .14s ease;
}
.mregcard:active,
.mregcard.is-opening {
  transform: scale(.992);
  border-color: rgba(139, 152, 255, .36);
  background: rgba(108, 124, 255, .08);
}
.mregcard .minfo { flex: 1; min-width: 0; }
.mregcard b {
  display: -webkit-box; font-size: 13.5px; line-height: 1.25; overflow: hidden;
  line-clamp: 2;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.mregcard .sub { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mregmeta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.mreg-archive-btn {
  width: 34px; height: 34px; flex-shrink: 0;
  align-self: center;
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-2);
}
.mreg-archive-btn.archive:hover,
.mreg-archive-btn.archive:active { color: #f87171; border-color: rgba(239, 68, 68, .4); }
.mreg-archive-btn.restore:hover,
.mreg-archive-btn.restore:active { color: var(--accent-2); border-color: rgba(139, 152, 255, .4); }
.mreview-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 4px 0 10px; padding: 12px 0 2px;
}
.mreview-head h2 { font-size: 17px; letter-spacing: -.02em; }
.mreview-head p { color: var(--text-3); font-size: 12px; margin-top: 3px; }
.mreview-head .btn { flex-shrink: 0; padding: 8px 11px; }
.mreview-card {
  width: 100%; text-align: left; color: inherit;
  border-color: rgba(234, 179, 8, .24); background: rgba(234, 179, 8, .055);
}
.mreview-card:active { transform: scale(.985); }
.mregister-page {
  padding-top: 10px;
}
.mobile-register-toolbar {
  display: flex; align-items: center; gap: 10px;
  position: sticky; top: 10px; z-index: 8;
  background: var(--bg); padding-top: 4px;
}
.mobile-register-toolbar .search { flex: 1; }
.mgallery-btn {
  position: relative; width: 42px; height: 42px; flex-shrink: 0; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 50%; background: var(--bg-2); color: var(--text-2);
}
.mgallery-badge {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--yellow); color: #111; font-size: 11px; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 3px 10px rgba(0, 0, 0, .28);
  will-change: transform;
}
.mphoto-sheet { padding-top: 8px; overflow-x: hidden; }
.mphoto-page .mreview-head {
  position: sticky; top: 0; z-index: 7;
  background: var(--bg); padding-top: 4px;
}
#mobileReview .mreview-head {
  position: sticky; top: 56px; z-index: 7;
  background: var(--bg);
}
.mphoto-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.mphoto-head h2 { font-size: 18px; letter-spacing: -.02em; }
.mphoto-head p { color: var(--text-3); font-size: 12px; margin-top: 4px; line-height: 1.45; }
.mphoto-section { margin-top: 14px; }
.mphoto-section h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 8px;
  position: sticky; top: 56px; z-index: 6;
  background: var(--bg); padding: 6px 0 8px;
}
.mphoto-page .mphoto-section h3 { top: 62px; }
.mphoto-card {
  width: 100%; max-width: 100%; min-width: 0;
  display: grid; grid-template-columns: 48px minmax(0, 1fr) 74px; align-items: center; gap: 8px; margin-bottom: 8px; text-align: left;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 14px; padding: 9px 10px;
}
.mphoto-thumb {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-2);
}
.mphoto-thumb::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .14);
  border-top-color: rgba(255, 255, 255, .52);
  opacity: .9;
  animation: spin .85s linear infinite;
  transition: opacity .16s ease;
}
.mphoto-thumb.is-loaded::after { opacity: 0; }
.mphoto-card img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg-2);
  flex-shrink: 0;
}
.mphoto-card img.js-thumb-loading { display: block; }
.mphoto-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.mphoto-meta b { font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mphoto-meta span { color: var(--text-3); font-size: 11.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mphoto-meta .mphoto-location { color: var(--accent-2); }
.mphoto-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.mphoto-retake, .mphoto-delete {
  width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 50%;
}
.mphoto-retake {
  border: 1px solid var(--border); background: rgba(255, 255, 255, .03); color: var(--text-2);
}
.mphoto-delete {
  border: 1px solid rgba(239, 68, 68, .22); border-radius: 50%; background: rgba(239, 68, 68, .08); color: #f87171;
}
.mphoto-retake svg, .mphoto-delete svg { width: 15px; height: 15px; }
.mphoto-open { padding-right: 12px; }
.mphoto-empty { padding: 14px 0; }

/* archived register entries — kept visible but clearly inactive */
.reg tr.archived td { opacity: .45; }
.reg tr.archived .thumb { filter: grayscale(1); }
.mregcard.archived { opacity: .55; }
.mregcard.archived .thumb { filter: grayscale(1); }
.msheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--bg-2); border-top: 1px solid var(--border); border-radius: 16px 16px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  height: 92dvh; max-height: 92dvh; overflow-y: auto;
  animation: sheetup .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes sheetup { from { transform: translateY(48px); opacity: 0; } }
.msheet-grab { width: 38px; height: 4px; border-radius: 2px; background: var(--border-2); margin: 2px auto 14px; }
.msheet-titleline { margin-bottom: 10px; }
.msheet-titleline h2 {
  font-size: 18px; letter-spacing: -.02em; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msheet-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: start; }
.msheet-photo {
  position: relative; display: grid; margin-bottom: 0; min-width: 0;
  width: 100%; aspect-ratio: 1 / 1; align-self: start;
}
.msheet-swap {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; padding: 0;
  display: grid; place-items: center; border-radius: 8px;
  background: rgba(9, 11, 16, .62); border: 1px solid rgba(255, 255, 255, .14);
  color: #fff; box-shadow: 0 6px 14px rgba(0, 0, 0, .18); backdrop-filter: blur(8px);
}
.msheet-swap svg { width: 13px; height: 13px; }
.msheet-swap:hover { background: rgba(23, 27, 36, .92); border-color: var(--accent-2); text-decoration: none; }
.msheet-img { width: 100%; height: 100%; min-height: 0; border-radius: 12px; object-fit: cover; }
.msheet-noimg { display: grid; place-items: center; font-size: 30px; background: var(--bg-3); border: 1px solid var(--border); }
.msheet-hero-meta { display: flex; flex-direction: column; justify-content: flex-start; gap: 12px; padding-top: 2px; min-width: 0; }
.msheet-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 0; }
.msheet-topfacts { display: grid; gap: 8px; margin-top: 0; }
.msheet-topfacts { padding-left: 9px; }
.msheet-topfacts div { min-width: 0; padding: 0; background: none; border: none; }
.msheet-topfacts span { display: block; color: var(--text-3); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin-bottom: 2px; }
.msheet-topfacts b { display: block; font-size: 13px; line-height: 1.25; overflow-wrap: anywhere; }
.msheet-quickfacts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.msheet-quickfacts div { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 11px; min-width: 0; }
.msheet-quickfacts span { display: block; color: var(--text-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin-bottom: 3px; }
.msheet-quickfacts b { display: block; font-size: 13px; overflow-wrap: anywhere; }
.msheet-notes { display: grid; gap: 8px; margin-top: 14px; }
.msheet-notes section { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 11px 12px; }
.msheet-notes h3 { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px; }
.msheet-notes p { font-size: 13px; line-height: 1.45; color: var(--text-2); }
.msheet-factrows { display: grid; gap: 8px; margin-top: 8px; }
.msheet-factrow { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 11px 12px; }
.msheet-factrow span { display: block; color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin-bottom: 3px; }
.msheet-factrow b { display: block; font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
.msheet-actions { margin-top: 10px; min-height: 40px; }
.msheet-actions .btn { width: 100%; justify-content: center; margin-top: 0; }
.msheet-close-placeholder { visibility: hidden; pointer-events: none; }
.msheet .btn { width: 100%; justify-content: center; margin-top: 10px; }
.msheet .cap-desktop-hint { margin-top: 16px; }
