/* 아하브 스캐너 */
:root {
  --bg: #F3F6FC; --surface: #FFFFFF; --sunk: #E8EEF9; --ink: #0F1B33; --muted: #55627C; --line: #DCE4F2;
  --accent: #2F6FDB; --accent-2: #4C8DF6; --accent-ink: #FFFFFF; --accent-soft: #E1ECFD;
  --in: #1C6FD1; --out: #D6402F; --gold: #E0A92E; --ok: #0F7B5F; --bad: #C2362B; --new: #E8590C; --hl: #FFF4D1;
  --shadow: 0 1px 2px rgba(15,27,51,.04), 0 8px 24px rgba(15,27,51,.06);
  --hero: radial-gradient(120% 120% at 100% 0%, #8FB8FF 0%, transparent 55%), linear-gradient(135deg, #0E2A66 0%, #2F6FDB 60%, #5B9BFF 100%);
  --hero-shadow: 0 12px 32px rgba(47,111,219,.28); --hero-ink: #123A8C;
  --font-ui: "Pretendard", "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; --radius: 18px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0B1220; --surface: #121C30; --sunk: #1A2740; --ink: #E7EEFB; --muted: #9FB0CF; --line: #24344F;
  --accent: #7FB0FF; --accent-2: #5B9BFF; --accent-ink: #08162E; --accent-soft: #1A2F55; --hl: #33301A;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
} }
.bigbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.bigbtns label { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 8px; border-radius: 16px; background: rgba(255,255,255,.14); color: #fff; font-weight: 800; cursor: pointer; text-align: center; border: 1px solid rgba(255,255,255,.25); }
.bigbtns label span { font-size: 30px; line-height: 1; }
.bigbtns label.main { background: #fff; color: var(--hero-ink); }
.bigbtns input { display: none; }
.edit-wrap { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; margin: 0 auto; background: #111; border-radius: 12px; overflow: hidden; }
.edit-wrap canvas { display: block; width: 100%; height: auto; }
.edit-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hd { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: rgba(47,111,219,.25); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(0,0,0,.4); touch-action: none; cursor: grab; }
.hd::after { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: #fff; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 13px; font-size: 13.5px; font-weight: 700; }
.filters button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 560px) { .pages { grid-template-columns: repeat(4, 1fr); } }
.pg { position: relative; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.pg img, .pg canvas { width: 100%; aspect-ratio: 1 / 1.35; object-fit: contain; background: var(--sunk); display: block; }
.pg .n { position: absolute; top: 6px; left: 6px; background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 8px; }
.pg .acts { display: flex; justify-content: space-between; padding: 4px; }
.pg .acts button { border: 0; background: none; font-size: 15px; padding: 4px 6px; border-radius: 8px; color: var(--muted); }
.pg.sel { outline: 3px solid var(--accent); outline-offset: -3px; }
.pg.sel::after { content: "✓"; position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 900; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.pg .rot { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; border-radius: 8px; padding: 1px 6px; }
.addpg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 2px dashed var(--accent); border-radius: 12px; color: var(--accent); font-weight: 800; cursor: pointer; background: var(--accent-soft); min-height: 150px; font-size: 13px; }
.addpg span { font-size: 28px; }
.addpg input { display: none; }
.toolgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toolgrid button { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 3px; box-shadow: var(--shadow); position: relative; }
.toolgrid button span { font-size: 26px; line-height: 1.1; } .toolgrid button b { font-size: 15px; } .toolgrid button small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.toolgrid button i { position: absolute; top: 10px; right: 12px; font-style: normal; font-size: 12px; }
.flist .fi { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.flist .fi:first-child { border-top: 0; }
.flist .fi span:first-child { font-size: 22px; text-align: center; }
.flist .fi small { display: block; color: var(--muted); font-size: 12px; }
.sigpad { width: 100%; height: 180px; border: 2px dashed var(--line); border-radius: 14px; background: #fff; touch-action: none; display: block; }
.sigs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.sigs button { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 4px; width: 110px; height: 56px; position: relative; }
.sigs button img { max-width: 100%; max-height: 100%; }
.sigs button.on { border-color: var(--accent); }
.place { position: relative; touch-action: none; margin: 10px auto 0; box-shadow: var(--shadow); }
.place canvas { display: block; width: 100%; height: auto; border: 1px solid var(--line); }
.place img.stamp { position: absolute; cursor: move; outline: 2px dashed var(--accent); touch-action: none; }
.docs .doc { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.docs .doc:first-child { border-top: 0; }
.docs .doc img { width: 56px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--sunk); }
.docs .doc b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs .doc small { color: var(--muted); font-size: 12px; }
.docs .doc .da { display: flex; flex-direction: column; gap: 4px; }
.busyov { position: fixed; inset: 0; z-index: 60; background: rgba(10,15,30,.55); display: flex; align-items: center; justify-content: center; }
.busyov div { background: var(--surface); border-radius: 16px; padding: 18px 22px; display: flex; gap: 12px; align-items: center; font-weight: 700; }
input[type=range] { width: 100%; accent-color: var(--accent); }
