:root{--navy:#0F2A4A;--accent:#1957D0;--soft:#EEF3FC;--line:#D6DCE5;--sub:#5B6472;--ink:#1A1F27;--bg:#F5F6F8;--me:#1957D0}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{background:var(--bg);color:var(--ink);font-family:-apple-system,BlinkMacSystemFont,"Hiragino Sans","Hiragino Kaku Gothic ProN","Yu Gothic UI",sans-serif;font-size:16px;line-height:1.6;-webkit-font-smoothing:antialiased;display:flex;flex-direction:column}
.top{position:sticky;top:0;z-index:5;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:12px;padding:10px 16px;flex-wrap:wrap}
.brand{font-weight:800;font-size:22px;color:var(--navy);letter-spacing:-.02em}
.ttl{display:flex;flex-direction:column;line-height:1.3}
.ttl b{font-size:14px;color:var(--navy)}
.ttl span{font-size:12px;color:var(--sub)}
.prog{flex-basis:100%;height:4px;background:#E6EAF0;border-radius:2px;overflow:hidden}
.prog i{display:block;height:100%;width:0;background:var(--accent);transition:width .3s}
main{flex:1;overflow-y:auto;padding:16px 16px 8px;max-width:720px;width:100%;margin:0 auto}
.msg{display:flex;margin:8px 0}
.msg .b{max-width:86%;padding:10px 14px;border-radius:16px;white-space:pre-wrap;word-break:break-word;font-size:15.5px}
.msg.bot .b{background:#fff;border:1px solid var(--line);border-top-left-radius:4px}
.msg.me{justify-content:flex-end}
.msg.me .b{background:var(--me);color:#fff;border-top-right-radius:4px}
.msg .b small{display:block;color:var(--sub);font-size:12.5px;margin-top:4px}
.msg.me .b small{color:#DCE6FA}
.edit{display:block;text-align:right;font-size:12px;color:var(--sub);margin:-2px 2px 6px;background:none;border:0;padding:0;cursor:pointer;width:100%;text-decoration:underline}
footer{position:sticky;bottom:0;background:#fff;border-top:1px solid var(--line);padding:10px 16px calc(10px + env(safe-area-inset-bottom))}
footer .in{max-width:720px;margin:0 auto}
.chips{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:8px}
.chip{border:1.5px solid var(--accent);color:var(--accent);background:#fff;border-radius:999px;padding:8px 14px;font-size:14.5px;cursor:pointer;font-family:inherit}
.chip.on{background:var(--accent);color:#fff}
.chip.ghost{border-color:var(--line);color:var(--sub)}
.row{display:flex;gap:8px;align-items:flex-end}
textarea,input[type=text],input[type=email]{flex:1;border:1.5px solid var(--line);border-radius:12px;padding:10px 12px;font-size:16px;font-family:inherit;resize:none;min-height:44px;max-height:160px;background:#fff;color:var(--ink);width:100%}
textarea:focus,input:focus{outline:none;border-color:var(--accent)}
.send{background:var(--accent);color:#fff;border:0;border-radius:12px;padding:0 16px;height:44px;font-size:15px;font-weight:700;cursor:pointer;font-family:inherit;flex:none}
.send:disabled{opacity:.4}
.send.wide{flex:1}
.sub{display:flex;justify-content:space-between;margin-top:8px;font-size:13px}
.sub button{background:none;border:0;color:var(--sub);text-decoration:underline;cursor:pointer;font-family:inherit;font-size:13px;padding:4px 0}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:8px}
.note{font-size:12.5px;color:var(--sub);margin:0 0 8px}
.err{color:#B42318;font-size:13px;margin:6px 0 0}
.files{font-size:13px;color:var(--sub);margin-bottom:8px}
.upl{display:inline-block;border:1.5px dashed var(--accent);color:var(--accent);border-radius:12px;padding:10px 14px;cursor:pointer;font-size:14.5px}
.upl input{display:none}
/* 完成したシート */
.sheet{background:#fff;border:1px solid var(--line);border-radius:14px;padding:18px;margin:12px 0}
.sheet h1{font-size:18px;color:var(--navy);margin:0 0 4px}
.sheet .meta{font-size:12.5px;color:var(--sub);margin-bottom:10px}
.sheet h2{font-size:15px;color:var(--navy);margin:16px 0 6px;padding-top:10px;border-top:1px solid var(--line)}
.sheet table{width:100%;border-collapse:collapse;font-size:13.5px}
.sheet th,.sheet td{border:1px solid var(--line);padding:6px 8px;text-align:left;vertical-align:top}
.sheet th{background:#F5F7FA;width:34%;font-weight:700}
.sheet thead th{background:var(--navy);color:#fff;width:auto}
.sheet .tw{overflow-x:auto}
.sheet .empty{color:#9AA3B0}
.actions{display:flex;gap:8px;flex-wrap:wrap;margin:8px 0 24px}
.actions button{border:1.5px solid var(--accent);background:#fff;color:var(--accent);border-radius:10px;padding:9px 14px;font-size:14px;cursor:pointer;font-family:inherit}
.actions button.pri{background:var(--accent);color:#fff}
.conf{font-size:10px;font-weight:700;letter-spacing:.12em;background:var(--navy);color:#fff;padding:2px 8px;float:right}
@media print{
  .top,footer,.msg,.edit,.actions{display:none!important}
  body{background:#fff;display:block}
  main{overflow:visible;padding:0;max-width:none}
  .sheet{border:0;padding:0;margin:0}
  .sheet .tw{overflow:visible}
}
