:root {
  --blue: #4a90d9;
  --blue-dark: #357abd;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #e4e8ee;
  --text: #2b3440;
  --muted: #8794a3;
  --shadow: 0 1px 3px rgba(20, 40, 70, 0.08);
  --shadow-md: 0 4px 16px rgba(20, 40, 70, 0.12);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 14px; }

/* ---------- Login ---------- */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #4a90d9 0%, #6aa9e6 50%, #8fc0ef 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 14px; padding: 40px 36px;
  width: 100%; max-width: 400px; box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}
.login-logo { display: flex; align-items: center; gap: 10px; justify-content: center; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--blue); color: #fff; font-weight: 800; font-size: 20px;
}
.logo-text, .brand-name { font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.login-sub { text-align: center; color: var(--muted); margin: 8px 0 24px; }
.quick-login { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border, #e0e0e0); }
.quick-login-label { text-align: center; color: var(--muted); font-size: 12px; margin: 0 0 10px; }
.quick-login-btns { display: flex; gap: 8px; }
.btn-quick { flex: 1; padding: 10px 4px; font-size: 13px; border: 1px solid var(--border, #d0d0d0); border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }
.btn-quick:active { opacity: 0.6; }
#login-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
#login-form input {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe;
}
#login-form input:focus { outline: none; border-color: var(--blue); background: #fff; }
.btn-primary {
  background: var(--blue); color: #fff; border-radius: 8px; padding: 11px 18px;
  font-weight: 700; font-size: 15px; transition: background .15s;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-block { width: 100%; }
.login-error {
  background: #fdecec; color: #c0392b; padding: 9px 12px; border-radius: 8px;
  font-size: 13px; margin-bottom: 12px;
}
.demo-accounts { margin-top: 22px; border-top: 1px dashed var(--border); padding-top: 16px; }
.demo-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.demo-acc {
  display: block; width: 100%; text-align: left; font-size: 12.5px; color: var(--text);
  background: #f4f7fb; border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; margin-bottom: 8px; transition: background .12s;
}
.demo-acc:hover { background: #e9f1fb; border-color: var(--blue); }
.demo-acc b { color: var(--blue); margin-right: 6px; }

/* ---------- App layout ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 240px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 16px;
}
.sidebar-brand { display: flex; align-items: center; gap: 9px; padding-bottom: 18px; }

/* board switcher */
.board-switcher { margin-bottom: 16px; }
.switcher-label { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .4px; text-transform: uppercase; display: block; margin-bottom: 7px; }
.board-list { display: flex; flex-direction: column; gap: 6px; }
.board-pick {
  display: flex; gap: 10px; align-items: center; background: #f4f7fb; border: 1px solid transparent;
  border-radius: 10px; padding: 10px; text-align: left; transition: background .12s, border-color .12s;
}
.board-pick:hover { background: #e9f1fb; }
.board-pick.active { background: #e9f1fb; border-color: var(--blue); }
.board-pick-icon {
  width: 34px; height: 34px; border-radius: 8px; background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.board-pick.active .board-pick-icon { box-shadow: 0 0 0 2px rgba(74,144,217,.25); }
.board-pick-body { display: flex; flex-direction: column; min-width: 0; }
.board-pick-name { font-weight: 700; font-size: 13px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-pick-sub { font-size: 11px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  font-size: 14px; color: var(--text); text-align: left; transition: background .12s;
}
.nav-item span { font-size: 16px; }
.nav-item:hover { background: #f4f7fb; }
.nav-item.active { background: #e9f1fb; color: var(--blue); font-weight: 700; }
.sidebar-foot { margin-top: auto; font-size: 11px; color: var(--muted); padding-top: 14px; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 60px; flex-shrink: 0; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
}
.hamburger { display: none; font-size: 20px; }
#page-title { font-size: 17px; font-weight: 700; white-space: nowrap; }
.search-box { position: relative; margin-left: 10px; }
.search-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
#search-input {
  width: 260px; max-width: 40vw; padding: 8px 12px 8px 32px; border: 1px solid var(--border);
  border-radius: 20px; background: #f4f6f9;
}
#search-input:focus { outline: none; border-color: var(--blue); background: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.me-avatar {
  width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.btn-ghost { color: var(--muted); font-size: 13px; padding: 6px 10px; border-radius: 6px; }
.btn-ghost:hover { background: #f4f6f9; color: var(--text); }

.tab-content { flex: 1; overflow: auto; }
.board-toolbar { padding: 14px 20px 0; }
.btn-light {
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px;
  font-size: 13px; color: var(--text); font-weight: 600;
}
.btn-light:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- Board ---------- */
.board { display: flex; gap: 14px; padding: 14px 20px 24px; align-items: flex-start; min-height: 100%; }
.list {
  width: 288px; flex-shrink: 0; background: #eef1f5; border-radius: 12px;
  display: flex; flex-direction: column; max-height: calc(100vh - 150px);
}
.list-head { padding: 12px 14px 8px; }
.list-color-bar { height: 4px; border-radius: 3px; margin-bottom: 9px; }
.list-title-row { display: flex; align-items: center; gap: 8px; }
.list-title {
  font-weight: 700; font-size: 14px; flex: 1; border: 1px solid transparent;
  border-radius: 5px; padding: 2px 4px; background: transparent;
}
.list-title:focus { outline: none; border-color: var(--blue); background: #fff; }
.list-count {
  background: #d6dce4; color: #55606e; border-radius: 10px; padding: 1px 9px;
  font-size: 12px; font-weight: 700;
}
.cards { padding: 4px 10px 10px; overflow-y: auto; flex: 1; min-height: 20px; }
.card {
  background: #fff; border-radius: 9px; box-shadow: var(--shadow); padding: 11px 12px;
  margin-bottom: 9px; cursor: pointer; border: 1px solid transparent; transition: box-shadow .12s, border-color .12s;
}
.card:hover { box-shadow: var(--shadow-md); border-color: #d4dbe4; }
.card-label { display: inline-block; height: 6px; width: 40px; border-radius: 4px; margin-bottom: 8px; }
.card-labeltext {
  display: inline-block; font-size: 11px; font-weight: 700; color: #fff;
  padding: 2px 8px; border-radius: 4px; margin-bottom: 8px;
}
.card-num { color: var(--muted); font-size: 11px; font-weight: 700; }
.card-title { font-size: 13.5px; line-height: 1.45; margin: 3px 0 9px; word-break: break-word; }
.card-foot { display: flex; align-items: center; justify-content: space-between; }
.card-dates { font-size: 11px; color: var(--muted); }
.card-dates.overdue { color: #e74c3c; font-weight: 700; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.card-meta-row { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 11px; color: var(--muted); }
.chip { background: #eef1f5; border-radius: 5px; padding: 1px 7px; }
.add-card {
  width: 100%; text-align: left; color: var(--muted); font-size: 13px; padding: 8px 12px;
  border-radius: 8px; margin: 2px 10px 10px; width: calc(100% - 20px);
}
.add-card:hover { background: #e4e9f0; color: var(--blue); }
.sortable-ghost { opacity: .4; }
.sortable-drag { transform: rotate(2deg); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,30,50,.45);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 680px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); position: relative; padding: 26px 30px 30px;
}
.modal-close {
  position: absolute; top: 14px; right: 16px; font-size: 18px; color: var(--muted);
  width: 32px; height: 32px; border-radius: 8px;
}
.modal-close:hover { background: #f0f2f5; color: var(--text); }
.m-labelrow { margin-bottom: 4px; }
.m-num { color: var(--muted); font-size: 12px; font-weight: 700; }
.m-title {
  width: 100%; font-size: 20px; font-weight: 700; border: 1px solid transparent; border-radius: 8px;
  padding: 6px 8px; margin: 4px 0 18px; line-height: 1.35; min-height: 40px; overflow: hidden;
  display: block; resize: none;
}
.m-title:focus { outline: none; border-color: var(--blue); background: #fbfcfe; }
.m-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 20px; margin-bottom: 20px; }
.m-field label { display: block; font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
.m-field select, .m-field input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe;
}
.m-field select:focus, .m-field input:focus { outline: none; border-color: var(--blue); background: #fff; }
.m-section-title { font-size: 13px; font-weight: 700; margin: 20px 0 8px; display: flex; align-items: center; gap: 8px; }
.m-desc {
  width: 100%; min-height: 90px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #fbfcfe; resize: vertical; line-height: 1.6;
}
.m-desc:focus { outline: none; border-color: var(--blue); background: #fff; }

/* checklist */
.progress-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.progress-bar { flex: 1; height: 8px; background: #e8ebef; border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; background: #52c41a; border-radius: 5px; transition: width .2s; }
.progress-txt { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.check-item { display: flex; align-items: center; gap: 9px; padding: 5px 0; }
.check-item input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); cursor: pointer; flex-shrink: 0; }
.check-item .ci-text { flex: 1; font-size: 13.5px; }
.check-item .ci-text.done { text-decoration: line-through; color: var(--muted); }
.ci-del { color: var(--muted); font-size: 15px; opacity: 0; padding: 0 4px; }
.check-item:hover .ci-del { opacity: 1; }
.ci-del:hover { color: #e74c3c; }
.check-add { display: flex; gap: 8px; margin-top: 8px; }
.check-add input { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; }
.check-add input:focus { outline: none; border-color: var(--blue); }
.btn-sm { background: var(--blue); color: #fff; border-radius: 8px; padding: 7px 14px; font-weight: 700; font-size: 13px; }
.btn-sm:hover { background: var(--blue-dark); }

/* comments */
.comment {
  display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f0f2f5;
}
.comment-body { flex: 1; }
.comment-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.comment-name { font-weight: 700; font-size: 13px; }
.comment-time { font-size: 11px; color: var(--muted); }
.comment-text { font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.comment-del { color: var(--muted); font-size: 12px; opacity: 0; }
.comment:hover .comment-del { opacity: 1; }
.comment-del:hover { color: #e74c3c; }
.comment-form { display: flex; gap: 10px; margin-top: 12px; }
.comment-form textarea {
  flex: 1; min-height: 42px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  resize: vertical; line-height: 1.5; background: #fbfcfe;
}
.comment-form textarea:focus { outline: none; border-color: var(--blue); background: #fff; }
.m-meta { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; }
.m-delete { color: #e74c3c; font-size: 12px; font-weight: 600; }
.m-delete:hover { text-decoration: underline; }

/* ---------- Gantt ---------- */
.gantt { padding: 20px; }
.gantt-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.gantt-table { border-collapse: collapse; min-width: 100%; }
.gantt-table th, .gantt-table td { border-bottom: 1px solid #eef1f5; }
.gantt-name-col { position: sticky; left: 0; background: #fff; z-index: 2; }
.gantt-head th { background: #f7f9fc; font-size: 11.5px; color: var(--muted); font-weight: 700; padding: 8px 6px; text-align: center; white-space: nowrap; }
.gantt-head .gantt-name-col { text-align: left; padding-left: 16px; min-width: 260px; }
.gantt-row td { height: 40px; position: relative; }
.gantt-row .gantt-name-col { padding: 6px 16px; font-size: 12.5px; max-width: 300px; }
.gantt-name-inner { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.gantt-cell { width: 30px; padding: 0; }
.gantt-bar-track { position: absolute; inset: 0; }
.gantt-bar {
  position: absolute; top: 10px; height: 20px; border-radius: 5px; color: #fff;
  font-size: 10.5px; line-height: 20px; padding: 0 6px; white-space: nowrap; overflow: hidden;
}
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #e74c3c; z-index: 3; }
.gantt-month-sep { border-left: 2px solid #dfe4ea !important; }
.gantt-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; font-size: 12px; }
.gantt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gantt-legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* ---------- Members ---------- */
.members { padding: 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.member-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 18px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow);
}
.member-avatar { width: 48px; height: 48px; border-radius: 50%; font-size: 18px; }
.member-name { font-weight: 700; font-size: 15px; }
.member-email { font-size: 12.5px; color: var(--muted); margin: 2px 0 4px; }
.role-badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 10px; }
.role-manager { background: #e9f1fb; color: var(--blue); }
.role-member { background: #eef1f5; color: #55606e; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #2b3440; color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 13px;
  box-shadow: var(--shadow-md); z-index: 200; opacity: 1; transition: opacity .3s;
}

/* ---------- Role-based visibility ---------- */
.role-viewer .editable-only,
.role-viewer .add-card { display: none !important; }
.nav-admin { display: none; }
.role-admin .nav-admin { display: flex; }

.role-pill { font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 10px; white-space: nowrap; }
.role-pill-admin { background: #e9f1fb; color: var(--blue); }
.role-pill-member { background: #eef1f5; color: #55606e; }
.role-pill-viewer { background: #fdecec; color: #c0392b; }

.muted-note { color: var(--muted); font-size: 12.5px; }

/* ---------- Board toolbar / filters ---------- */
.board-toolbar { padding: 14px 20px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-sel {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
  font-size: 12.5px; color: var(--text);
}
.filter-sel:focus { outline: none; border-color: var(--blue); }
.filter-clear { font-size: 12px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

/* recurrence chip */
.chip-rec { background: #eef7ee; }

/* ---------- Modal actions / hours ---------- */
.m-actions { display: flex; align-items: center; gap: 14px; }
.m-act { font-size: 12px; font-weight: 600; color: var(--blue); }
.m-act:hover { text-decoration: underline; }

/* card activity in modal */
.card-activity { display: flex; flex-direction: column; gap: 8px; max-height: 180px; overflow-y: auto; padding: 4px 0; }
.act-row { display: flex; gap: 9px; align-items: flex-start; }
.act-avatar { width: 24px; height: 24px; font-size: 10px; }
.act-body { display: flex; flex-direction: column; }
.act-text { font-size: 13px; line-height: 1.4; }
.act-time { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* ---------- Gantt drag ---------- */
.gantt-bar { cursor: grab; user-select: none; display: flex; align-items: center; }
.gantt-bar:active { cursor: grabbing; }
.gantt-bar-label { overflow: hidden; text-overflow: ellipsis; pointer-events: none; flex: 1; }
.gantt-handle { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; }
.gantt-handle-l { left: 0; border-radius: 5px 0 0 5px; }
.gantt-handle-r { right: 0; border-radius: 0 5px 5px 0; }
.gantt-bar:hover .gantt-handle { background: rgba(255,255,255,.35); }
.gantt-hint { color: var(--muted); font-size: 11.5px; }

/* ---------- Archive ---------- */
.archive { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.archive-row {
  background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; box-shadow: var(--shadow);
}
.archive-main { min-width: 0; }
.archive-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.archive-title .card-labeltext { margin-bottom: 0; }
.archive-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Activity view ---------- */
.activity-view { padding: 20px; }
.activity-list {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 8px 18px;
  box-shadow: var(--shadow); max-width: 820px;
}
.activity-list .act-row { padding: 12px 0; border-bottom: 1px solid #f0f2f5; }
.activity-list .act-row:last-child { border-bottom: none; }
.activity-list .act-avatar { width: 30px; height: 30px; font-size: 12px; }
.activity-list .act-text { font-size: 13.5px; }

/* ---------- Labels admin ---------- */
.labels-admin { padding: 24px; max-width: 720px; }
.section-h { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.labels-head { margin-bottom: 18px; }
.label-create {
  display: flex; gap: 8px; align-items: center; margin-bottom: 18px; background: #fff;
  border: 1px solid var(--border); border-radius: 10px; padding: 12px; box-shadow: var(--shadow);
}
.label-create input[type=text] { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.label-create input[type=text]:focus { outline: none; border-color: var(--blue); }
input[type=color] { width: 40px; height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
.label-row {
  display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
}
.label-preview { margin-bottom: 0; min-width: 70px; text-align: center; }
.label-name-input { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; }
.label-name-input:focus { outline: none; border-color: var(--blue); }
.label-usage { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.label-del { color: #e74c3c; font-size: 12px; font-weight: 600; }
.label-del:hover { text-decoration: underline; }

/* role badges (3-tier) */
.role-badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 10px; }
.role-admin { background: #e9f1fb; color: var(--blue); }
.role-member { background: #eef1f5; color: #55606e; }
.role-viewer { background: #fdecec; color: #c0392b; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .sidebar { position: fixed; z-index: 50; height: 100%; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-md); }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: block; }
  #search-input { width: 150px; }
  .m-grid { grid-template-columns: 1fr; }
  .modal { padding: 22px 18px; }
}

/* ================= Notifications / Push / User menu (prod) ================= */
.bell-wrap, .user-wrap { position: relative; }
.bell-btn {
  position: relative; width: 38px; height: 38px; border-radius: 10px;
  background: #fff; border: 1px solid var(--border); font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow);
}
.bell-btn:hover { background: #f0f4fa; }
.bell-badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px;
  background: #e74c3c; color: #fff; border-radius: 10px; font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.notif-panel {
  position: absolute; top: 46px; right: 0; width: 340px; max-width: 90vw;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md);
  z-index: 60; overflow: hidden;
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 800; }
.notif-readall { color: var(--blue); font-size: 12.5px; font-weight: 700; }
.notif-readall:hover { text-decoration: underline; }
.notif-push-row { padding: 10px 14px; border-bottom: 1px solid var(--border); background: #f8fafc; }
.push-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.push-toggle input { width: 16px; height: 16px; }
.push-note { color: var(--muted); font-size: 11px; margin-top: 5px; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid #f0f2f5; cursor: pointer; }
.notif-item:hover { background: #f5f8fc; }
.notif-item.unread { background: #eef5fe; }
.notif-item.unread:hover { background: #e4f0fd; }
.notif-ico { font-size: 16px; line-height: 1.4; }
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 13px; line-height: 1.45; }
.notif-time { color: var(--muted); font-size: 11px; margin-top: 3px; }

.me-avatar { cursor: pointer; }
.user-menu {
  position: absolute; top: 46px; right: 0; width: 220px; background: #fff;
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md); z-index: 60; overflow: hidden;
}
.user-menu-head { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; line-height: 1.5; }
.user-menu-item { display: block; width: 100%; text-align: left; padding: 11px 14px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.user-menu-item:hover { background: #f5f8fc; }

/* mention */
.mention { color: var(--blue); font-weight: 700; background: #eaf2fc; border-radius: 4px; padding: 0 2px; }
.comment-input-wrap { position: relative; flex: 1; }
.mention-pop {
  position: absolute; left: 0; bottom: 100%; margin-bottom: 4px; width: 240px; max-height: 220px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); z-index: 50;
}
.mention-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; cursor: pointer; }
.mention-item.active, .mention-item:hover { background: #eef5fe; }

/* mini modal */
.mini-modal {
  position: relative; background: #fff; border-radius: 14px; padding: 26px 24px;
  width: 100%; max-width: 420px; box-shadow: var(--shadow-md); margin: auto;
}
.mini-h { font-size: 17px; font-weight: 800; margin-bottom: 12px; }
.mini-form { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.mini-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 700; color: #55606e; }
.mini-form input, .mini-form select { border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; }
.mini-form input[type="color"] { padding: 2px; height: 38px; }

/* member table */
.member-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.member-table th { text-align: left; font-size: 12px; color: var(--muted); padding: 10px 12px; background: #f8fafc; border-bottom: 1px solid var(--border); }
.member-table td { padding: 10px 12px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
.member-table tr:last-child td { border-bottom: none; }
.member-inactive { opacity: 0.55; }
.member-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.member-actions .btn-sm { background: #eef2f7; color: var(--text); padding: 6px 10px; font-size: 12px; }
.member-actions .btn-sm:hover { background: #e1e8f0; }
.status-on { color: #2e9e51; font-weight: 700; font-size: 12.5px; }
.status-off { color: #b0453c; font-weight: 700; font-size: 12.5px; }
.members-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.role-viewer .nav-admin, .role-viewer .editable-only { display: none; }
body:not(.role-admin) .nav-admin { display: none; }

@media (max-width: 640px) {
  .notif-panel { position: fixed; top: 56px; right: 8px; left: 8px; width: auto; }
  .member-actions { flex-direction: column; }
  /* topbar: ベル・アバターが画面外に出ないよう全要素を375px内に収める */
  .topbar { gap: 8px; padding: 0 12px; }
  #page-title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .role-pill { display: none; }
  .search-box { flex: 1 1 60px; min-width: 0; margin-left: 0; }
  #search-input { width: 100%; min-width: 0; max-width: none; }
  .topbar-right { flex-shrink: 0; gap: 8px; }
  .user-menu { position: fixed; top: 56px; right: 8px; }
}
