*{box-sizing:border-box}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans JP",sans-serif;background:#f3f5f8;color:#222}.top{background:#1878a8;color:#fff;padding:14px 24px;display:flex;align-items:center;justify-content:space-between;gap:20px}.brand{font-size:20px;font-weight:700}.top nav{display:flex;gap:16px;flex-wrap:wrap}.top a{color:#fff;text-decoration:none}.layout{display:grid;grid-template-columns:230px 1fr;min-height:calc(100vh - 58px)}.sidebar{background:#26313b;padding:14px 0}.side-title{padding:8px 18px;color:#aeb9c3;font-size:12px}.menu-item,.menu-add{display:flex;justify-content:space-between;color:#fff;text-decoration:none;padding:11px 18px;border-left:3px solid transparent}.menu-item:hover,.menu-add:hover{background:#34424e;border-left-color:#4db2e5}.menu-item b{background:#455562;border-radius:12px;padding:1px 7px;font-size:11px}.menu-add{color:#9edcff;margin-top:8px}.content{padding:22px;max-width:1400px;width:100%}.panel{background:#fff;border:1px solid #d8dee7;border-radius:8px;padding:18px;margin-bottom:18px;box-shadow:0 1px 2px rgba(0,0,0,.03)}h1{font-size:22px;margin:0 0 8px}h2{font-size:17px;margin:0 0 12px}.home-head,.thread-head{display:flex;justify-content:space-between;align-items:center;gap:16px}.button,button{display:inline-block;background:#1878a8;color:#fff;border:0;border-radius:5px;padding:9px 14px;text-decoration:none;cursor:pointer;font-size:14px}button:hover,.button:hover{opacity:.9}.danger{background:#b43a3a}.linkbtn{background:#eef5f9;color:#126690}.hidden{display:none!important}.new-thread{border-top:1px solid #e5e8ed;margin-top:15px;padding-top:15px}label{display:block;margin:10px 0;font-size:14px}input,select,textarea{width:100%;border:1px solid #bcc7d4;border-radius:4px;padding:9px;font:inherit;background:#fff}textarea{resize:vertical;line-height:1.65}.inline-form{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.inline-form input,.inline-form select{width:auto;min-width:220px}.order{min-width:80px!important;width:90px!important}.thread-table{padding:0;overflow:hidden}.thread-row{display:grid;grid-template-columns:minmax(260px,1fr) 90px 110px 170px;align-items:center;text-decoration:none;color:#222;border-bottom:1px solid #e5e8ed;min-height:60px;padding:8px 14px}.thread-row:not(.header):hover{background:#f7fbfd}.thread-row.header{background:#e6edf7;font-weight:700;min-height:42px}.thread-row small{display:block;color:#78828c;margin-top:3px}.status{display:inline-block;border-radius:14px;padding:3px 9px;font-size:12px}.status.open{background:#fff2ca;color:#765800}.status.resolved{background:#dff3e5;color:#22663a}.breadcrumb{margin:0 0 12px;color:#6d7780}.breadcrumb a{color:#1878a8}.direction{display:flex;gap:18px;margin:8px 0 12px}.direction label{display:flex;gap:6px;align-items:center;margin:0}.direction input{width:auto}.file-label{background:#f5f7f9;border:1px dashed #bcc7d4;padding:10px;border-radius:5px}.file-label input{margin-top:7px}.post-card{scroll-margin-top:18px;background:#fff;border:1px solid #d7dde5;border-left:5px solid #1878a8;border-radius:6px;padding:16px;margin-bottom:14px}.post-card.received{border-left-color:#5d8b4b}.post-meta{display:flex;gap:12px;align-items:center;margin-bottom:13px;color:#68727c;font-size:13px}.post-meta a{margin-left:auto;color:#1878a8}.badge{background:#1878a8;color:#fff;border-radius:4px;padding:3px 8px}.received .badge{background:#5d8b4b}.post-body{white-space:normal;line-height:1.75}.thumbs{display:flex;gap:9px;flex-wrap:wrap;margin-top:14px}.thumb-wrap{position:relative}.thumb{width:150px;height:110px;object-fit:cover;border:1px solid #ccd3db;border-radius:4px;cursor:zoom-in}.tiny{padding:4px 7px;font-size:11px;margin-top:4px}.lightbox{position:fixed;inset:0;background:rgba(0,0,0,.84);display:flex;align-items:center;justify-content:center;z-index:1000}.lightbox img{max-width:92vw;max-height:90vh;object-fit:contain}.lightbox button{position:absolute;right:24px;top:18px;font-size:28px;background:transparent}.flash,.error{max-width:1000px;margin:14px auto;padding:12px 16px;border-radius:6px}.flash{background:#e4f4e8;color:#235d33}.error{background:#fde8e8;color:#8a2020}.auth{min-height:100vh;display:grid;place-items:center;background:#eef2f6}.auth-card{width:min(440px,92vw);background:#fff;border:1px solid #d7dde5;border-radius:10px;padding:28px;box-shadow:0 8px 28px rgba(0,0,0,.08)}.auth-card h1{text-align:center;margin-bottom:22px}.check{display:flex;align-items:center;gap:8px}.check input{width:auto}.search-form{display:grid;grid-template-columns:minmax(240px,1fr) 180px 140px 140px auto;gap:8px}.search-result{display:block;text-decoration:none;color:#222;border-top:1px solid #e4e8ee;padding:13px 4px}.search-result span{display:block;color:#7b858e;font-size:12px;margin:4px 0}.search-result p{margin:4px 0}.empty{padding:24px;text-align:center;color:#7a838c}.admin-row{display:flex;gap:8px;justify-content:space-between;padding:8px 0;border-top:1px solid #e5e8ed}.note{color:#69737c;font-size:13px}.cancel{margin-left:8px;color:#667}.compose textarea{min-height:160px}hr{border:0;border-top:1px solid #e2e6eb;margin:22px 0}
@media(max-width:820px){.top{padding:12px 14px;align-items:flex-start;flex-direction:column}.layout{grid-template-columns:1fr}.sidebar{display:flex;overflow:auto;padding:6px}.side-title{display:none}.menu-item,.menu-add{white-space:nowrap;padding:9px 12px;border-left:0}.content{padding:12px}.thread-row{grid-template-columns:1fr 70px}.thread-row>div:nth-child(3),.thread-row>div:nth-child(4){display:none}.search-form{grid-template-columns:1fr}.home-head,.thread-head{align-items:flex-start;flex-direction:column}.admin-row{flex-direction:column}.inline-form input,.inline-form select{width:100%;min-width:0}.thumb{width:110px;height:85px}}

/* v0.1.1 reply UI */
.post-actions{margin-left:auto;display:flex;align-items:center;gap:12px}.post-actions a{margin-left:0}.text-button{background:none!important;color:#1878a8!important;padding:0!important;border:0;border-radius:0;font-size:13px;text-decoration:underline}.reply-post{margin-left:28px;border-top-left-radius:0}.reply-label{font-weight:700;color:#65717d}.reply-context{background:#f6f8fa;border-left:3px solid #aeb9c3;border-radius:4px;padding:9px 11px;margin:-2px 0 14px;font-size:12px;color:#5d6872}.reply-preview{margin-top:5px;color:#737d86}.mini-badge{display:inline-block;border-radius:3px;padding:2px 6px;color:#fff;font-size:11px}.mini-badge.sent{background:#1878a8}.mini-badge.received{background:#5d8b4b}.reply-form{margin-top:16px;padding:14px;background:#f7fafc;border:1px solid #cfd9e2;border-radius:6px}.reply-form-title{font-weight:700;margin-bottom:8px;color:#42515d}.reply-form textarea{min-height:120px}
@media(max-width:820px){.reply-post{margin-left:12px}.post-meta{flex-wrap:wrap}.post-actions{margin-left:auto}.reply-context{font-size:11px}}


/* v0.1.2 conversation order: parent first, replies directly below */
.post-card.reply-post{margin-left:calc(min(var(--reply-depth,1),4) * 32px);position:relative;border-top-left-radius:6px}
.post-card.reply-post:before{content:"";position:absolute;left:-18px;top:-15px;width:14px;height:34px;border-left:2px solid #cbd5df;border-bottom:2px solid #cbd5df;border-bottom-left-radius:8px}
.post-card.root-post{margin-top:18px}
.post-card.root-post:first-child{margin-top:0}
@media(max-width:820px){.post-card.reply-post{margin-left:calc(min(var(--reply-depth,1),4) * 14px)}.post-card.reply-post:before{left:-10px;width:7px}}


/* v0.1.3 auto-link URLs in post body */
.post-body .body-url{color:#0b72b9;text-decoration:underline;text-underline-offset:2px;overflow-wrap:anywhere}
.post-body .body-url:visited{color:#0b72b9}
.post-body .body-url:hover{text-decoration-thickness:2px}


/* v0.1.5 category menu reorder */
.category-admin-row{align-items:center;justify-content:flex-start}
.category-move-buttons{display:flex;gap:5px;flex:0 0 auto}
.category-move-buttons form{margin:0}
.move-button{width:38px;height:38px;padding:0;font-size:18px;line-height:1;background:#5e7485}
.move-button:disabled{opacity:.25;cursor:default}
.category-name-form{flex:1;min-width:280px}
.category-name-form input[name="name"]{flex:1;min-width:220px}
.category-admin-row>form:last-child{margin-left:auto}
@media(max-width:820px){.category-admin-row{flex-direction:row;flex-wrap:wrap}.category-move-buttons{order:1}.category-name-form{order:2;min-width:calc(100% - 92px);flex:1}.category-admin-row>form:last-child{order:3;margin-left:82px}.category-name-form input[name="name"]{min-width:0;flex:1}}

/* v0.1.6 reply auto-scroll + category memo */
.reply-form{scroll-margin:24px 0}
.category-memo{padding:14px 18px}
.category-memo-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}
.category-memo-head h2{margin:0}
.category-memo-body{background:#f8fafc;border:1px solid #e1e7ee;border-radius:6px;padding:12px 14px;min-height:46px}
.category-memo-body .body-url{color:#0b72b9;text-decoration:underline;text-underline-offset:2px;overflow-wrap:anywhere}
.category-memo-body .body-url:visited{color:#0b72b9}
.category-memo-editor{margin-top:12px;padding-top:12px;border-top:1px solid #e4e8ee}
.category-memo-editor textarea{min-height:150px}
.memo-actions{display:flex;gap:8px;margin-top:9px}
.memo-empty{color:#8a939b;font-size:13px}

/* v0.1.7: thread list pagination */
.pagination{display:flex;align-items:center;justify-content:center;gap:7px;flex-wrap:wrap;margin:18px 0 4px}
.page-link{display:inline-flex;align-items:center;justify-content:center;min-width:38px;height:38px;padding:0 11px;border:1px solid #c7d4df;border-radius:7px;background:#fff;color:#177aa8;text-decoration:none;font-weight:600;box-sizing:border-box}
.page-link:hover{background:#eef7fb;border-color:#9ec7da}
.page-link.current{background:#1d7da8;border-color:#1d7da8;color:#fff;cursor:default}
.page-link.prev,.page-link.next{min-width:auto;padding:0 14px}
.page-ellipsis{color:#778692;padding:0 2px}
@media(max-width:600px){.pagination{gap:5px}.page-link{min-width:34px;height:36px;padding:0 9px}.page-link.prev,.page-link.next{padding:0 10px}}
