:root {
    --bg: #f3f5f7;
    --panel: #ffffff;
    --line: #d9dee5;
    --text: #1f2937;
    --muted: #687386;
    --accent: #2563eb;
    --accent-soft: #e8f0ff;
    --danger: #b42318;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: "Segoe UI", "Noto Sans JP", sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; }
button, input, textarea { font: inherit; }
.app-shell { height: 100vh; display: grid; grid-template-rows: 58px 58px 1fr; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 18px; background: #1f2937; color: #fff; }
.brand { font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.searchbar { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.searchbar input { flex: 1; min-width: 0; }
input[type="text"], input[type="url"], input[type="search"], textarea { width: 100%; border: 1px solid #cbd2dc; border-radius: 7px; padding: 9px 11px; background: #fff; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.10); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid #c7ced8; background: #fff; color: #253043; padding: 8px 13px; border-radius: 7px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f6f8fb; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.danger { color: var(--danger); border-color: #e8b5b1; }
.btn.ghost { background: transparent; }
.btn.full { width: 100%; margin-top: 8px; }
.workspace { min-height: 0; display: grid; grid-template-columns: 245px 1fr; }
.tag-pane { min-height: 0; background: #f8fafc; border-right: 1px solid var(--line); padding: 13px; overflow-y: auto; }
.pane-title { font-weight: 700; margin-bottom: 9px; }
.tag-list { display: flex; flex-direction: column; gap: 3px; }
.tag-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 5px; border-radius: 5px; cursor: pointer; }
.tag-row:hover { background: #edf2f7; }
.count { font-size: 12px; color: var(--muted); min-width: 24px; text-align: right; }
.tag-add-box { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.tag-add-box label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.content-pane { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(210px, 39%) 1fr; background: var(--panel); }
.list-pane { min-height: 0; display: grid; grid-template-rows: 38px 1fr; border-bottom: 1px solid var(--line); }
.list-header { display: grid; grid-template-columns: 1fr 105px; align-items: center; padding: 0 14px; font-size: 12px; font-weight: 700; color: var(--muted); background: #f8fafc; border-bottom: 1px solid var(--line); }
.list-header span:last-child { text-align: right; }
.article-list { min-height: 0; overflow-y: auto; }
.article-row { width: 100%; border: 0; border-bottom: 1px solid #edf0f4; background: #fff; display: grid; grid-template-columns: 1fr 105px; gap: 10px; padding: 10px 14px; text-align: left; cursor: pointer; }
.article-row:hover { background: #f8fafc; }
.article-row.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.article-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.article-date { text-align: right; color: var(--muted); font-size: 13px; }
.detail-pane { min-height: 0; overflow-y: auto; background: #fff; }
.detail-card { padding: 20px 22px 32px; max-width: 1200px; }
.detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.detail-title-row h1 { margin: 0; font-size: 22px; line-height: 1.45; }
.detail-actions { display: flex; gap: 7px; }
.detail-actions form { margin: 0; }
.meta-grid { display: flex; flex-wrap: wrap; gap: 18px; margin: 12px 0; color: var(--muted); font-size: 13px; }
.meta-label { font-weight: 700; margin-right: 6px; color: #536071; }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip { background: #eef2f7; border: 1px solid #dde3eb; border-radius: 999px; padding: 3px 9px; font-size: 12px; }
.detail-section { margin-top: 17px; }
.section-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.external-link { color: #1459c7; overflow-wrap: anywhere; }
.article-body { line-height: 1.75; white-space: normal; overflow-wrap: anywhere; }
.loading, .empty, .empty-small { color: var(--muted); padding: 18px; }
.empty-small { padding: 6px 0; font-size: 13px; }
.detail-empty { padding: 30px; }
.editor-shell { min-height: 100vh; padding: 24px; }
.editor-card { max-width: 980px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(31,41,55,.06); }
.editor-header { display: flex; justify-content: space-between; align-items: center; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.editor-header h1 { margin: 0; font-size: 21px; }
.editor-form { padding: 20px; display: grid; gap: 8px; }
.editor-form > label { margin-top: 8px; font-weight: 700; font-size: 14px; }
.required { color: #c02626; font-size: 12px; margin-left: 4px; }
.editor-tags { display: flex; flex-wrap: wrap; gap: 8px 13px; padding: 10px; background: #f8fafc; border: 1px solid var(--line); border-radius: 7px; }
.tag-check { display: inline-flex; align-items: center; gap: 5px; }
.editor-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
@media (max-width: 760px) {
    .app-shell { height: auto; min-height: 100vh; display: block; overflow: visible; }
    .workspace { grid-template-columns: 1fr; }
    .tag-pane { border-right: 0; border-bottom: 1px solid var(--line); max-height: 280px; }
    .content-pane { min-height: 700px; grid-template-rows: 300px 1fr; }
    .detail-title-row { flex-direction: column; }
    .editor-shell { padding: 10px; }
}

/* QA Memo v1.1 */
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-logout { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.topbar-logout:hover { background: rgba(255,255,255,.10); }
.tag-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.tag-heading-row .pane-title { margin-bottom: 0; }
.tag-sort-form select { max-width: 108px; border: 1px solid #cbd2dc; border-radius: 6px; padding: 5px 7px; background: #fff; color: var(--text); font-size: 12px; }
.login-page { min-height: 100vh; }
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 30px; box-shadow: 0 14px 38px rgba(31,41,55,.10); }
.login-brand { text-align: center; font-size: 27px; font-weight: 750; margin-bottom: 7px; }
.login-subtitle { text-align: center; color: var(--muted); margin-bottom: 22px; }
.login-form { display: grid; gap: 12px; }
.login-form input[type="password"] { width: 100%; border: 1px solid #cbd2dc; border-radius: 7px; padding: 11px 12px; background: #fff; outline: none; text-align: center; font-size: 20px; letter-spacing: .25em; }
.login-form input[type="password"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.10); }
.login-button { width: 100%; padding: 10px 13px; }
.login-error { color: var(--danger); text-align: center; font-size: 13px; }

/* QA Memo v1.2 */
.tag-order-note { font-size: 11px; color: var(--muted); }
.tag-row { cursor: default; }
.tag-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px; min-width: 0; flex: 1; cursor: pointer; }
.tag-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-move-buttons { display: flex; gap: 2px; }
.tag-move-btn { width: 25px; height: 25px; padding: 0; border: 1px solid #cbd2dc; border-radius: 5px; background: #fff; color: #475569; cursor: pointer; line-height: 1; }
.tag-move-btn:hover:not(:disabled) { background: #eef2f7; }
.tag-move-btn:disabled { opacity: .3; cursor: default; }
.hidden-form { display: none; }
.login-form input#accessCodeInput { width: 100%; border: 1px solid #cbd2dc; border-radius: 7px; padding: 11px 12px; background: #fff; outline: none; text-align: center; font-size: 20px; letter-spacing: .25em; -webkit-text-security: disc; }
.login-form input#accessCodeInput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.10); }
