/* CAIA-PRF LIFF — クライアント側UI */
:root {
  --bg: #f6f7f9; --panel: #fff; --line: #e3e6ea; --text: #1f2328; --muted: #6b7280;
  --accent: #2563eb; --ok: #15803d; --warn: #b45309; --danger: #b91c1c;
  --bar: 52px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6;
  font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  min-height: 100dvh;
}
.hidden { display: none !important; }

/* ---- ヘッダー ---- */
.appbar {
  height: var(--bar); background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  position: sticky; top: 0; z-index: 20;
}
.appbar .back { border: none; background: none; font-size: 20px; color: var(--text); padding: 4px 6px; }
.appbar .title { font-size: 15px; font-weight: 600; flex: 1; overflow: hidden;
                 text-overflow: ellipsis; white-space: nowrap; }
.appbar .zoom { border: 1px solid var(--line); background: #fff; border-radius: 8px;
                width: 34px; height: 32px; font-size: 15px; }

/* ---- 一覧 ---- */
.list { padding: 14px; }
.section-label { font-size: 12.5px; color: var(--muted); margin: 4px 2px 8px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin-bottom: 10px; display: block; text-decoration: none; color: inherit;
}
.card.unread { border-left: 4px solid var(--accent); }
.card .row1 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.card .name { font-weight: 600; font-size: 15px; }
.card .proj { color: var(--muted); font-size: 12.5px; }
.card .meta { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px;
         border: 1px solid var(--line); background: #f3f4f6; color: var(--muted); }
.badge.type { background: #f1f5f9; color: #334155; border-color: #dbe3ec; }
.badge.ok { background: #e8f5ec; color: var(--ok); border-color: #cbe6d4; }
.badge.warn { background: #fef3e2; color: var(--warn); border-color: #f5dcb3; }
.badge.new { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- ビューア ---- */
#viewer { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; background: #525659; }
#stage { transform-origin: 0 0; width: max-content; margin: 0 auto; padding: 12px; }
#stage .page { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); margin-bottom: 12px; position: relative; }
#stage canvas, #stage img { display: block; }
.pin {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  border-radius: 50%; background: var(--accent); color: #fff; border: 2px solid #fff;
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.pin.resolved { background: var(--ok); }
.docview { display: flex; flex-direction: column; height: 100dvh; }

/* ---- 下部シート ---- */
.sheet { background: #fff; border-top: 1px solid var(--line); max-height: 46dvh;
         display: flex; flex-direction: column; }
.sheet .handle { padding: 8px 14px; border-bottom: 1px solid var(--line);
                 display: flex; align-items: center; gap: 8px; font-size: 13px; }
.sheet .handle button { margin-left: auto; }
.sheet .body { overflow-y: auto; padding: 10px 14px; }
.comment { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.comment:last-child { border-bottom: none; }
.comment .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.comment.staff .who { color: var(--accent); }

/* ---- ボタン・フォーム ---- */
.btn { display: inline-block; padding: 11px 18px; border-radius: 9px; border: 1px solid var(--accent);
       background: var(--accent); color: #fff; font-size: 15px; text-align: center; cursor: pointer; }
.btn.ghost { background: #fff; color: var(--accent); }
.btn.wide { display: block; width: 100%; }
.btn.small { padding: 7px 13px; font-size: 13px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
textarea, input[type=text] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 15px; font-family: inherit; }
textarea { min-height: 64px; resize: vertical; }

/* ---- 承認バー ---- */
.approve-bar { background: #fff; border-top: 1px solid var(--line); padding: 12px 14px; }
.agree { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px;
         margin-bottom: 10px; line-height: 1.5; }
.agree input { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.blocked { background: #fef3e2; color: var(--warn); border: 1px solid #f5dcb3;
           border-radius: 8px; padding: 9px 12px; font-size: 13px; }
.approved-note { background: #e8f5ec; color: var(--ok); border: 1px solid #cbe6d4;
                 border-radius: 8px; padding: 10px 12px; font-size: 13.5px; }

/* ---- モーダル ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
            display: flex; align-items: center; justify-content: center; padding: 22px; }
.modal { background: #fff; border-radius: 14px; padding: 20px; max-width: 340px; width: 100%; }
.modal h3 { font-size: 16px; margin-bottom: 8px; }
.modal p { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.modal .actions { display: flex; gap: 10px; }
.modal .actions > * { flex: 1; }

.state { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.err { background: #fdecec; color: var(--danger); border: 1px solid #f5c9c9;
       border-radius: 8px; padding: 10px 13px; font-size: 13.5px; margin: 14px; }
