:root {
  --bg: #f5f6f8; --panel: #fff; --ink: #1c2530; --muted: #6b7683;
  --line: #e5e8ec; --brand: #2b6cb0; --brand-ink: #fff;
  --ok: #2f855a; --warn: #b7791f; --danger: #c53030; --draft: #718096;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* display 指定より優先して必ず非表示 */
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.6 -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif; }

/* ヘッダ */
.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .02em; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.ws-switch { display: flex; align-items: center; gap: 8px; }
.ws-switch-label { font-size: 12px; color: var(--muted); }
#ws-select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--ink); max-width: 240px; }
.me { display: flex; align-items: center; gap: 10px; }
.me-name { font-weight: 600; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--line); object-fit: cover; border: 1px solid var(--line); }

/* 新規ワークスペース作成バー */
.ws-create-bar { display: flex; gap: 8px; align-items: center; padding: 10px 20px;
  background: #eef4fb; border-bottom: 1px solid var(--line); }
.ws-create-bar input { flex: 0 1 320px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }

/* ログイン */
.card.center { max-width: 420px; margin: 60px auto; text-align: center; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 28px; }
h1 { font-size: 20px; margin: 0 0 6px; } h2 { font-size: 16px; margin: 0; } h3 { font-size: 13px; margin: 0 0 8px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .ta-right { text-align: right; }

/* レイアウト：左=ワークスペース設定 / 右=サイト */
.layout { display: grid; grid-template-columns: 280px 1fr; min-height: calc(100vh - 53px); }
@media (max-width: 760px) { .layout { grid-template-columns: 1fr; } }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 16px; }
.side-head { font-weight: 700; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.ws-badges { display: flex; gap: 6px; margin: 10px 0 16px; flex-wrap: wrap; }
.side-section { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line); }
.side-invite { display: flex; gap: 6px; margin-top: 8px; }
.side-invite input { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }

.main { padding: 22px 26px; overflow-x: auto; }
.empty { display: grid; place-items: center; min-height: 60vh; text-align: center; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.inline-create { display: flex; gap: 8px; }
.inline-create input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; min-width: 220px; }

/* サイト一覧テーブル */
.site-table { width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.site-table th, .site-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.site-table thead th { background: #f8fafc; font-size: 12px; color: var(--muted); font-weight: 700; }
.site-table tbody tr:last-child td { border-bottom: none; }
.site-table .st-name { font-weight: 600; }
.site-table .st-url { color: var(--muted); font-size: 12px; word-break: break-all; }
.site-table .st-url a { color: var(--brand); text-decoration: none; }
.site-empty td { text-align: center; color: var(--muted); padding: 28px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }

input, textarea { font: inherit; }
textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); resize: vertical; }
.btn { padding: 8px 12px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { background: #f0f2f5; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-primary:hover { filter: brightness(1.06); background: var(--brand); }
.btn-ghost { border-color: transparent; }
.btn-lg { padding: 10px 18px; font-size: 15px; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.corporate { background: #ebf8ff; color: var(--brand); }
.badge.personal { background: #edf2f7; color: var(--draft); }
.badge.role { background: #f7fafc; color: var(--muted); border: 1px solid var(--line); }
.badge.published { background: #e6fffa; color: var(--ok); }
.badge.draft { background: #edf2f7; color: var(--draft); }
.badge.running { background: #ebf8ff; color: var(--brand); }
.badge.invited { background: #fffaf0; color: var(--warn); }
.note { border-radius: 8px; padding: 8px 10px; font-size: 12px; background: #fffaf0; color: var(--warn); border: 1px solid #f6e05e; margin-top: 8px; }
.dev { margin-top: 18px; text-align: left; }
.dev summary { cursor: pointer; color: var(--muted); }
.dev textarea { margin: 8px 0; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; max-width: 80%; z-index: 10; }
.toast.err { background: var(--danger); }
