:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #6b7280;
  --accent: #0ea5e9;
  --accent-2: #f97316;
  --border: #e5e7eb;
  --shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
  font-family: 'Space Grotesk', 'Noto Sans JP', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 20%, #e0f2fe 0, #f6f7fb 40%),
    radial-gradient(circle at 80% 10%, #ffe9d5 0, #f6f7fb 45%),
    var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

actions { display: flex; }

h1 { margin: 4px 0; font-size: 28px; }
h2 { margin: 8px 0; font-size: 22px; }
.subtitle { color: var(--muted); margin: 0; max-width: 720px; }
.eyebrow { letter-spacing: 0.1em; font-size: 12px; color: var(--accent-2); margin: 0; text-transform: uppercase; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; }

.actions { display: flex; gap: 10px; align-items: center; }
.user-box { display: grid; gap: 4px; text-align: right; }
.user-box p { margin: 0; font-weight: 600; }

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.search {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
}
.search input {
  border: none;
  outline: none;
  font-size: 16px;
  background: transparent;
  color: var(--ink);
}
.icon { opacity: 0.6; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 10px;
  border-radius: 12px;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip.active {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}

.layout { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.composer textarea,
.composer .text,
.detail .text,
.detail textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.composer textarea:focus,
.composer .text:focus,
.detail .text:focus,
.detail textarea:focus {
  border-color: var(--accent);
  background: #fff;
}

.composer textarea { height: 180px; resize: vertical; }
.composer .text { margin: 8px 0; }
.composer-head { display: flex; justify-content: space-between; align-items: baseline; }
.hint { color: var(--muted); font-size: 13px; }

.composer-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }

button {
  border: none;
  background: linear-gradient(135deg, var(--accent), #38bdf8);
  color: white;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 12px 30px rgba(14, 165, 233, 0.35);
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }

button.ghost, .file-label {
  background: transparent;
  color: var(--ink);
  border: 1px dashed var(--border);
  box-shadow: none;
  padding: 9px 12px;
}
button.danger { color: #b91c1c; border-color: #fecdd3; }
.file-label { cursor: pointer; border-radius: 12px; }

.switch { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-size: 14px; color: var(--muted); }
.switch.inline { margin-top: 6px; }
.switch input { display: none; }
.switch .slider {
  width: 42px; height: 24px; background: #e5e7eb; border-radius: 999px; position: relative; transition: background 0.2s ease;
}
.switch .slider::after {
  content: '';
  width: 18px; height: 18px; background: #fff; border-radius: 50%; position: absolute; top: 3px; left: 3px; box-shadow: 0 3px 10px rgba(0,0,0,0.1); transition: transform 0.2s ease;
}
.switch input:checked + .slider { background: #22d3ee; }
.switch input:checked + .slider::after { transform: translateX(18px); }

.board { display: flex; flex-direction: column; gap: 14px; }
.board-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.count { color: var(--muted); font-size: 14px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.note {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 6px;
  cursor: pointer;
  position: relative;
  min-height: 160px;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}
.note:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.note h3 { margin: 0; font-size: 17px; }
.note .snippet { color: var(--muted); font-size: 14px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.note .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.note .tag { background: #f1f5f9; color: #0f172a; border-radius: 10px; padding: 4px 8px; font-size: 12px; }
.note .meta { color: var(--muted); font-size: 12px; }
.note .pin { position: absolute; top: 10px; right: 10px; color: #f59e0b; font-size: 16px; }

#detailDialog::backdrop { background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(3px); }
.detail { width: min(720px, 92vw); }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.detail-body { width: 100%; height: 340px; margin-top: 12px; border-radius: 14px; border: 1px solid var(--border); padding: 12px; font-size: 15px; background: #f8fafc; }
.detail-actions { display: flex; gap: 8px; align-items: center; }
.meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; color: var(--muted); }
.title-input { font-size: 20px; font-weight: 600; }
.auth { width: min(420px, 90vw); display: grid; gap: 12px; }
.auth .detail-actions { justify-content: flex-end; }

#toast { position: fixed; bottom: 24px; right: 24px; background: #0ea5e9; color: white; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); transition: all 0.25s ease; pointer-events: none; }
#toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .composer { order: 1; }
  .board { order: 2; }
  .topbar { flex-direction: column; }
}
