/* Kambana OS - Scanner */
.app-scanner { background: var(--surface); }
.app-scanner .sc-bar { gap: 8px; }
.app-scanner .sc-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-fg); font-size: 11px; display: inline-grid; place-items: center; }
.app-scanner .sc-count[hidden] { display: none; }
.app-scanner .sc-body { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.app-scanner.sc-busy .sc-body::after { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, .15); cursor: progress; z-index: 5; }
.app-scanner .sc-bigic { width: 68px; height: 68px; border-radius: 22px; display: grid; place-items: center; background: rgba(var(--accent-rgb), .14); color: var(--accent); }

/* camera */
.app-scanner .sc-camera { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #0b0d12; }
.app-scanner .sc-camera .empty-state { background: var(--surface); }
.app-scanner .sc-vstage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.app-scanner .sc-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.app-scanner .sc-live { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.app-scanner .sc-hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: rgba(0, 0, 0, .55); color: #fff; font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 14px; white-space: nowrap; pointer-events: none; }
.app-scanner .sc-controls { flex: 0 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: #0b0d12; color: #fff; }
.app-scanner .sc-cside { display: flex; align-items: center; gap: 10px; }
.app-scanner .sc-cside.right { justify-content: flex-end; }
.app-scanner .sc-ghost { color: #fff; background: rgba(255, 255, 255, .12); }
.app-scanner .sc-ghost:hover { background: rgba(255, 255, 255, .2); }
.app-scanner .sc-controls .chip { background: rgba(255, 255, 255, .12); color: #fff; }
.app-scanner .sc-controls .chip.on { background: var(--accent); color: var(--accent-fg); }
.app-scanner .sc-shutter { width: 70px; height: 70px; border-radius: 50%; border: 4px solid #fff; background: transparent; padding: 4px; display: grid; place-items: center; transition: transform .1s; }
.app-scanner .sc-shutter i { width: 100%; height: 100%; border-radius: 50%; background: #fff; display: block; transition: transform .12s; }
.app-scanner .sc-shutter:active i { transform: scale(.88); }
.app-scanner .sc-lastthumb { width: 48px; height: 60px; border-radius: 8px; border: 2px solid #fff; background: #333 center / cover; position: relative; padding: 0; }
.app-scanner .sc-lastthumb.empty { border-color: rgba(255, 255, 255, .25); background: none; display: block; }
.app-scanner .sc-lastthumb b { position: absolute; right: -8px; top: -8px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent); color: var(--accent-fg); font-size: 11px; display: grid; place-items: center; }
.app-scanner .sc-flash { position: absolute; inset: 0; background: #fff; opacity: .85; pointer-events: none; animation: sc-flash .35s ease-out forwards; z-index: 4; }
@keyframes sc-flash { to { opacity: 0; } }

/* editor */
.app-scanner .sc-edit { flex: 1; min-height: 0; display: flex; }
.app-scanner .sc-editarea { flex: 1; min-width: 0; position: relative; background: var(--surface-3); background-image: radial-gradient(var(--line-2) 1px, transparent 1px); background-size: 20px 20px; touch-action: none; overflow: hidden; }
.app-scanner .sc-editcv { position: absolute; inset: 0; display: block; touch-action: none; }
.app-scanner .sc-loupe { position: absolute; width: 110px; height: 110px; border-radius: 50%; box-shadow: 0 0 0 3px #fff, 0 6px 20px rgba(0, 0, 0, .4); pointer-events: none; }
.app-scanner .sc-panel { width: 300px; flex: 0 0 auto; border-left: 1px solid var(--line); background: var(--sidebar); display: flex; flex-direction: column; gap: 4px; padding: 12px; overflow-y: auto; }
.app-scanner .sc-ptitle { display: flex; align-items: center; justify-content: space-between; }
.app-scanner .sc-ptitle .icon-btn { width: 28px; height: 28px; }
.app-scanner .sc-prevwrap { background: var(--surface-3); border-radius: 12px; padding: 10px; display: grid; place-items: center; min-height: 160px; margin: 6px 0; }
.app-scanner .sc-preview { max-width: 100%; max-height: 260px; border-radius: 4px; box-shadow: 0 2px 10px rgba(0, 0, 0, .25); background: #fff; transition: opacity .15s; }
.app-scanner .sc-preview.sc-working { opacity: .5; }
.app-scanner .sc-filters, .app-scanner .sc-tools { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px; }
.app-scanner .sc-del:hover { color: #e5484d; }
.app-scanner .sc-pfoot { margin-top: auto; padding-top: 12px; display: flex; justify-content: flex-end; }

/* pages */
.app-scanner .sc-pages { flex: 1; padding: 16px 20px 30px; }
.app-scanner .sc-tip { margin: 0 0 12px; font-size: 12.5px; }
.app-scanner .sc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.app-scanner .sc-page { background: var(--surface-2); border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); padding: 10px; display: flex; flex-direction: column; gap: 8px; transition: transform .12s, box-shadow .12s, opacity .12s; }
.app-scanner .sc-page.dragging { opacity: .4; }
.app-scanner .sc-page.over { box-shadow: inset 0 0 0 2px var(--accent); transform: scale(1.02); }
.app-scanner .sc-thumb { aspect-ratio: 3 / 4; border: 0; border-radius: 6px; background: #fff center / contain no-repeat; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); padding: 0; cursor: pointer; }
[data-theme="dark"] .app-scanner .sc-thumb { background-color: #2a3142; }
.app-scanner .sc-pagebar { display: flex; align-items: center; gap: 2px; }
.app-scanner .sc-pagebar b { flex: 1; font-size: 13px; padding-left: 4px; }
.app-scanner .sc-pagebar .icon-btn { width: 28px; height: 28px; }
.app-scanner .sc-addpage { border: 1.5px dashed var(--line-2); border-radius: 14px; background: none; color: var(--text-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 600; min-height: 220px; }
.app-scanner .sc-addpage:hover { border-color: var(--accent); color: var(--accent); }

.sc-dialog { width: min(460px, calc(100vw - 32px)); }
.sc-dialog .sc-form { display: flex; flex-direction: column; gap: 12px; margin: 14px 0 4px; text-align: left; }
.sc-dialog .sc-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.sc-dialog .sc-field .input { width: 100%; }
.sc-dialog .sc-field .seg { align-self: flex-start; }
.sc-dialog .sc-check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); cursor: pointer; }
.sc-dialog .sc-small, .app-scanner .sc-small { font-size: 12px; margin: 0; line-height: 1.45; }

@media (max-width: 759px) {
  .app-scanner .sc-tabs span, .app-scanner .sc-import span { display: none; }
  .app-scanner .sc-edit { flex-direction: column; }
  .app-scanner .sc-panel { width: auto; border-left: 0; border-top: 1px solid var(--line); max-height: 46%; }
  .app-scanner .sc-prevwrap { display: none; }
  .app-scanner .sc-controls { padding: 12px 14px; gap: 10px; }
  .app-scanner .sc-controls .chip span { display: none; }
  .app-scanner .sc-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .app-scanner .sc-pages { padding: 12px; }
}
