* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", Meiryo, sans-serif;
  background: #0f1419;
  color: #e7e9ea;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; background: #15202b; border-bottom: 1px solid #22303c;
  position: sticky; top: 0; z-index: 10;
}
.brand { font-size: 18px; font-weight: 700; }
.top-actions { display: flex; gap: 8px; align-items: center; }
#search {
  padding: 7px 12px; border-radius: 9999px; border: 1px solid #38444d;
  background: #1c2732; color: #e7e9ea; font-size: 13px; width: 240px;
}
#search:focus { outline: none; border-color: #1d9bf0; }
.btn {
  padding: 7px 14px; border: none; border-radius: 8px; cursor: pointer;
  background: #1d9bf0; color: #fff; font-size: 13px; font-weight: 600;
}
.btn:hover { background: #1a8cd8; }
.btn-ghost { background: #283340; color: #e7e9ea; }
.btn-ghost:hover { background: #38444d; }

.board {
  display: flex; gap: 14px; padding: 14px; align-items: flex-start;
  overflow-x: auto; overflow-y: hidden;
  height: calc(100vh - 56px); box-sizing: border-box;
}
.board::-webkit-scrollbar { height: 10px; }
.board::-webkit-scrollbar-thumb { background: #38444d; border-radius: 5px; }
.board::-webkit-scrollbar-track { background: #0f1419; }

.category {
  flex: 0 0 280px; width: 280px; background: #15202b; border-radius: 12px;
  border-top: 4px solid var(--cat-color, #1e88e5);
  display: flex; flex-direction: column;
  height: 100%; box-sizing: border-box;
}
.category.drag-over { outline: 2px dashed #1d9bf0; outline-offset: -2px; }
.category.cat-dragging { opacity: .45; }
.cat-head {
  display: flex; align-items: center; gap: 6px; padding: 10px 12px;
  cursor: grab; user-select: none; flex-shrink: 0;
}
.cat-head:active { cursor: grabbing; }
.cat-grip { color: #5a6b7a; font-size: 13px; cursor: grab; flex-shrink: 0; }
.cat-grip:hover { color: #8899a6; }
.cat-marker { flex: 0 0 4px; width: 4px; align-self: stretch; background: #1d9bf0; border-radius: 2px; }
.bm-marker { height: 3px; background: #1d9bf0; border-radius: 2px; margin: 2px 0; }
.cat-empty { text-align: center; color: #5a6b7a; font-size: 12px; padding: 14px 8px; border: 1px dashed #2b3640; border-radius: 8px; }
.cat-title { font-weight: 700; font-size: 14px; flex: 1; }
.cat-count { font-size: 11px; color: #8899a6; background: #22303c; border-radius: 9999px; padding: 1px 8px; }
.cat-menu { cursor: pointer; color: #8899a6; padding: 2px 6px; border-radius: 4px; }
.cat-menu:hover { background: #22303c; color: #fff; }
.cat-body { overflow-y: auto; padding: 0 8px 8px; flex: 1; }
.cat-add {
  margin: 4px 8px 10px; padding: 7px; border: 1px dashed #38444d; border-radius: 8px;
  text-align: center; color: #8899a6; cursor: pointer; font-size: 12px;
}
.cat-add:hover { border-color: #1d9bf0; color: #1d9bf0; }

.bm {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; margin-bottom: 6px;
  background: #1c2732; border-radius: 8px; cursor: grab; transition: background .12s;
  border: 1px solid transparent;
}
.bm:hover { background: #22303c; border-color: #38444d; }
.bm.dragging { opacity: .4; }
.bm-fav { width: 18px; height: 18px; flex-shrink: 0; border-radius: 4px; background: #38444d; object-fit: contain; }
.bm-main { flex: 1; min-width: 0; }
.bm-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-note { font-size: 11px; color: #8899a6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-del { color: #8899a6; cursor: pointer; opacity: 0; padding: 0 4px; font-size: 14px; }
.bm:hover .bm-del { opacity: 1; }
.bm-del:hover { color: #f4212e; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal.hidden { display: none; }
.modal-box { background: #15202b; border-radius: 12px; padding: 20px; width: 380px; max-width: 92vw; }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.modal-box label { display: block; font-size: 12px; color: #8899a6; margin: 10px 0 4px; }
.modal-box input, .modal-box select, .modal-box textarea {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid #38444d;
  background: #1c2732; color: #e7e9ea; font-size: 13px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.color-row { display: flex; gap: 6px; margin-top: 6px; }
.color-dot { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.color-dot.sel { border-color: #fff; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: rgba(29,155,240,0.95); color: #fff; padding: 9px 18px; border-radius: 9999px;
  font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== ログイン/登録ゲート ===== */
.auth-gate { position: fixed; inset: 0; background: #0f1419; display: flex; align-items: center; justify-content: center; z-index: 100; }
.auth-gate.hidden { display: none; }
.auth-box { background: #15202b; border-radius: 14px; padding: 28px; width: 340px; max-width: 92vw; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.auth-brand { font-size: 24px; font-weight: 800; text-align: center; margin-bottom: 18px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.auth-tab { flex: 1; padding: 8px; border: none; border-radius: 8px; background: #1c2732; color: #8899a6; font-size: 13px; font-weight: 600; cursor: pointer; }
.auth-tab.active { background: #1d9bf0; color: #fff; }
.auth-box input { width: 100%; box-sizing: border-box; padding: 10px 12px; margin-bottom: 10px; border-radius: 8px; border: 1px solid #38444d; background: #1c2732; color: #e7e9ea; font-size: 14px; }
.auth-box input:focus { outline: none; border-color: #1d9bf0; }
.auth-submit { width: 100%; padding: 11px; font-size: 15px; margin-top: 4px; }
.auth-error { color: #ff6b75; font-size: 12px; margin-top: 10px; min-height: 16px; text-align: center; }
.user-email { font-size: 12px; color: #8899a6; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== 検索バー（モード切替） ===== */
.search-wrap { display: flex; align-items: center; background: #1c2732; border: 1px solid #38444d; border-radius: 9999px; overflow: hidden; }
.search-wrap:focus-within { border-color: #1d9bf0; }
.search-mode { background: none; border: none; cursor: pointer; font-size: 15px; padding: 0 4px 0 10px; color: #e7e9ea; }
.search-mode:hover { transform: scale(1.15); }
.search-wrap #search { border: none; background: transparent; border-radius: 0; width: 240px; }
.search-wrap #search:focus { outline: none; }
