* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, system-ui, sans-serif;
  background: #111118; color: #e8e8f0;
  -webkit-tap-highlight-color: transparent;
}
section { min-height: 100%; }
header { padding: calc(env(safe-area-inset-top) + 12px) 16px 12px; display: flex; align-items: center; gap: 12px; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1rem; margin: 20px 0 8px; color: #aaa; }
.pad { padding: 0 16px calc(env(safe-area-inset-bottom) + 24px); }
.dim { color: #888; font-size: 0.85rem; margin-top: 8px; }
.row { display: flex; gap: 10px; margin: 8px 0; }
.row > * { flex: 1; }

input[type=text], textarea {
  width: 100%; padding: 12px; border-radius: 10px;
  border: 1px solid #333; background: #1c1c26; color: #e8e8f0;
  font-size: 1rem; margin-bottom: 10px;
}
textarea { font-family: ui-monospace, monospace; font-size: 0.9rem; }

button {
  border: none; border-radius: 10px; padding: 12px 16px;
  font-size: 1rem; background: #2a2a38; color: #e8e8f0; cursor: pointer;
}
button.primary { background: #4338ca; color: #fff; font-weight: 600; }
button.danger { background: #7f1d1d; color: #fff; }
button:active { opacity: 0.7; }
.chip {
  background: rgba(20,20,30,0.65); backdrop-filter: blur(6px);
  border-radius: 999px; padding: 8px 14px; font-size: 0.85rem; color: #fff;
}

ul { list-style: none; padding: 0; }
#session-list li, #page-list li {
  display: flex; align-items: center; gap: 12px;
  background: #1c1c26; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
}
#session-list .grow, #page-list .grow { flex: 1; min-width: 0; }
#session-list .title { font-weight: 600; }
#page-list img { width: 48px; height: 64px; object-fit: cover; border-radius: 6px; background: #000; }
#page-list .preview { font-size: 0.8rem; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { font-size: 0.75rem; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.status.queued  { background: #44403c; }
.status.running { background: #1d4ed8; }
.status.done    { background: #166534; }
.status.low     { background: #92400e; }
.status.error   { background: #991b1b; }
.iconbtn { padding: 8px 10px; font-size: 0.9rem; }

/* Capture view */
#view-capture { position: fixed; inset: 0; background: #000; overflow: hidden; }
#camera { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#capture-top {
  position: absolute; top: 0; left: 0; right: 0;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
#capture-title { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#capture-bottom {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 16px 20px calc(env(safe-area-inset-bottom) + 24px);
  display: flex; justify-content: space-between; align-items: center;
}
#btn-shutter {
  width: 76px; height: 76px; border-radius: 50%;
  background: #fff; border: 5px solid rgba(255,255,255,0.4);
  background-clip: padding-box; padding: 0;
}
#btn-shutter:active { transform: scale(0.92); }
#flash {
  position: absolute; inset: 0; background: #fff; opacity: 0;
  pointer-events: none; transition: opacity 0.18s ease-out;
}
#flash.on { opacity: 0.7; transition: none; }

#editor-img { width: 100%; max-height: 40vh; object-fit: contain; background: #000; border-radius: 10px; }
