/* X Studio — ダーク。目印は「黄色い線」（たどれば迷わない）。黄色は線・現在地・いちばん大事なボタンだけに使う */
:root {
  --bg: #14161A;
  --surface: #1B1E23;
  --surface-2: #23272E;
  --surface-3: #2B3038;
  --line: #2F343C;
  --ink: #E9EBEE;
  --sub: #A2A8B1;
  --mute: #6E7480;
  --yellow: #F2C200;
  --yellow-ink: #1A1500;
  --ok: #57C08B;
  --ok-bg: rgba(87, 192, 139, .12);
  --danger: #EF7A62;
  --danger-bg: rgba(239, 122, 98, .12);
  --sched: #8FB4FF;
  --sched-bg: rgba(143, 180, 255, .12);
  --font: "Zen Kaku Gothic New", system-ui, -apple-system, "Hiragino Sans", sans-serif;
  --num: "Inter", var(--font);
  --r: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.7 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; border-radius: 6px; }
.num { font-family: var(--num); font-feature-settings: "tnum"; }

/* 骨組み */
.shell { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 20px 14px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 600 16px/1 var(--num); letter-spacing: .01em; padding: 4px 8px; }
.brand svg { width: 26px; height: 26px; }
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--sub); font-weight: 500; position: relative; }
.nav a:hover { background: var(--surface); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--yellow); }
.count { font: 600 12px/1 var(--num); color: var(--sub); }
.count:empty { display: none; }
.dot:not(:empty) { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); font-size: 0; }
.side-foot { margin-top: auto; font-size: 12px; color: var(--mute); padding: 0 8px; }

main { padding: 28px clamp(16px, 4vw, 44px) 120px; max-width: 1180px; width: 100%; outline: none; }
.loading { color: var(--mute); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 26px; line-height: 1.3; font-weight: 700; letter-spacing: .01em; }
.page-head p { margin: 4px 0 0; color: var(--sub); font-size: 14px; }
h2 { font-size: 15px; margin: 0 0 12px; color: var(--sub); font-weight: 500; }

/* ボタン */
.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--yellow); color: var(--yellow-ink); border-color: transparent; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.btn.danger { background: transparent; color: var(--danger); border-color: rgba(239,122,98,.35); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--sub); }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn.sm { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.btn kbd { font: 500 11px/1 var(--num); padding: 3px 5px; border-radius: 5px; background: rgba(255,255,255,.08); color: inherit; opacity: .8; }
.btn.primary kbd { background: rgba(0,0,0,.12); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* 状態のしるし */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: var(--sub); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.draft { color: var(--sub); }
.chip.ok { color: var(--ok); background: var(--ok-bg); }
.chip.scheduled { color: var(--sched); background: var(--sched-bg); }
.chip.posting { color: var(--yellow); background: rgba(242,194,0,.1); }
.chip.posted { color: var(--mute); }
.chip.failed { color: var(--danger); background: var(--danger-bg); }
.chip.rejected { color: var(--mute); text-decoration: line-through; }
.chip.fix { color: var(--danger); background: var(--danger-bg); }
.tag { font-size: 12px; color: var(--sub); }

/* 今日: 路線図 */
.today-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.route { position: relative; padding-left: 92px; }
.route::before { content: ""; position: absolute; left: 70px; top: 14px; bottom: 14px; width: 4px; border-radius: 4px; background: var(--yellow); }
.stop { position: relative; margin-bottom: 26px; }
.stop:last-child { margin-bottom: 0; }
.stop-time { position: absolute; left: -92px; top: 14px; width: 54px; text-align: right; font: 600 15px/1 var(--num); color: var(--sub); }
.stop-dot { position: absolute; left: -29px; top: 10px; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); border: 4px solid var(--yellow); }
.stop.done .stop-dot { background: var(--yellow); }
.stop.next .stop-time { color: var(--yellow); }
.stop.next .stop-dot { box-shadow: 0 0 0 6px rgba(242,194,0,.16); }
.stop.past:not(.done) .stop-time { color: var(--mute); }
.stop-label { font-size: 13px; color: var(--sub); padding-top: 9px; }

/* 投稿カード */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head .pillar { font-weight: 700; font-size: 15px; }
.card-head .spacer { flex: 1; }
.parts { display: flex; flex-direction: column; gap: 10px; }
.part { position: relative; background: var(--surface-2); border-radius: 10px; padding: 12px 14px 10px; }
.part + .part::before { content: ""; position: absolute; left: 22px; top: -11px; width: 2px; height: 10px; background: var(--line); }
.part-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 12px; color: var(--mute); }
.part-text { white-space: pre-wrap; word-break: break-word; margin: 0; font-size: 15px; line-height: 1.75; }
.part-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.w { font: 500 12px/1 var(--num); color: var(--mute); }
.w.over { color: var(--danger); font-weight: 600; }
.quote { margin-top: 8px; font-size: 13px; color: var(--sub); display: flex; gap: 6px; align-items: baseline; word-break: break-all; }
.thumb { display: block; margin-top: 10px; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.note { margin-top: 10px; font-size: 13px; color: var(--sub); background: transparent; border-left: 2px solid var(--line); padding: 2px 0 2px 12px; white-space: pre-wrap; }
.note b { color: var(--ink); font-weight: 500; margin-right: 6px; }
.note.advice { border-color: var(--yellow); }
.note.err { border-color: var(--danger); color: var(--danger); }
.note.reply { border-color: var(--ok); }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.empty { color: var(--mute); padding: 28px; text-align: center; border: 1px dashed var(--line); border-radius: 14px; }

/* 今日やること */
.todo-list { display: flex; flex-direction: column; gap: 8px; }
.todo { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; }
.todo input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--yellow); }
.todo-title { font-weight: 500; font-size: 14.5px; line-height: 1.6; }
.todo-when { font: 500 12px/1.4 var(--num); color: var(--sub); }
.todo.done { opacity: .5; }
.todo.done .todo-title { text-decoration: line-through; }
.todo details { grid-column: 2; margin-top: 4px; }
.todo summary { cursor: pointer; font-size: 13px; color: var(--sub); }
.todo-detail { font-size: 13.5px; color: var(--sub); white-space: pre-wrap; margin: 8px 0; }
.copybox { background: var(--surface-2); border-radius: 9px; padding: 10px 12px; white-space: pre-wrap; font-size: 14px; margin: 6px 0; }

/* 確認 */
.review { max-width: 760px; }
.review-progress { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-bottom: 18px; }
.review-progress span { display: block; height: 100%; background: var(--yellow); }
.review .card { padding: 22px 24px; }
.review .part-text { font-size: 16px; }
.decide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.decide .btn { min-height: 48px; font-size: 15px; }
.fixbox { margin-top: 12px; display: none; }
.fixbox.open { display: block; }
textarea, input[type=text], input[type=date], input[type=time], input[type=url], input[type=number], select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 15px; line-height: 1.6;
}
textarea { min-height: 96px; resize: vertical; }
textarea:focus, input:focus, select:focus { border-color: var(--sub); outline: none; }
.keys { font-size: 12px; color: var(--mute); margin-top: 10px; }
.keys kbd { font: 500 11px/1 var(--num); padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; }

/* ネタ */
.tabs { display: inline-flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tabs button { appearance: none; border: 0; background: transparent; color: var(--sub); padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 14px; }
.tabs button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); }
.idea-new { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }
.idea-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.idea { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.idea.sel { border-color: var(--yellow); }
.idea-text { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; max-height: 12.5em; overflow: hidden; position: relative; }
.idea-text.long::after { content: ""; position: absolute; inset: auto 0 0; height: 3em; background: linear-gradient(transparent, var(--surface)); }
.idea-text.open { max-height: none; }
.idea-text.open::after { display: none; }
.idea-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--mute); }
.idea-actions { display: flex; gap: 8px; margin-top: auto; }

/* 予定 */
.day { margin-bottom: 26px; }
.day h3 { font: 600 14px/1 var(--num); color: var(--sub); margin: 0 0 10px; display: flex; gap: 10px; align-items: center; }
.day h3 .today-mark { color: var(--yellow); }
.slot { display: grid; grid-template-columns: 56px minmax(120px, 220px) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; cursor: pointer; text-align: left; width: 100%; color: inherit; font: inherit; }
.slot:hover { border-color: var(--sub); }
.slot .t { font: 600 14px/1 var(--num); }
.slot .first { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--sub); font-size: 14px; }
.slot .pl { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* シート（編集） */
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; }
.sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--surface); border-left: 1px solid var(--line); z-index: 41; display: flex; flex-direction: column; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; color: var(--ink); font-size: 17px; font-weight: 700; }
.sheet-body { overflow: auto; padding: 18px 20px 30px; display: flex; flex-direction: column; gap: 16px; }
.sheet-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--sub); display: flex; justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.part-edit { position: relative; }
.part-edit .rm { position: absolute; top: -4px; right: 0; }

/* 設定・数字 */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; }
.panel h2 { color: var(--ink); font-weight: 700; font-size: 16px; }
.panel p { color: var(--sub); margin: 6px 0; font-size: 14px; }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--surface-3); position: relative; cursor: pointer; margin: 0; border: 1px solid var(--line); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--sub); transition: transform .15s; }
.switch input:checked { background: var(--yellow); }
.switch input:checked::after { transform: translateX(18px); background: var(--yellow-ink); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--sub); font-weight: 500; font-size: 13px; }
td.n { font-family: var(--num); text-align: right; }

/* お知らせ */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.toast.bad { background: var(--danger); color: #1a0a06; }

@media (max-width: 960px) {
  .today-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: var(--bg); z-index: 30; flex-direction: row; }
  .brand, .side-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-between; }
  .nav li { flex: 1; }
  .nav a { flex-direction: column; gap: 0; padding: 6px 2px; font-size: 12px; justify-content: center; }
  .nav a[aria-current="page"]::before { left: 30%; right: 30%; top: -7px; bottom: auto; width: auto; height: 3px; }
  .count { font-size: 10px; }
  main { padding: 18px 16px 110px; }
  .route { padding-left: 66px; }
  .route::before { left: 46px; }
  .stop-time { left: -66px; width: 36px; font-size: 13px; }
  .stop-dot { left: -27px; }
  .slot { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .slot .first { display: none; }
  .decide { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .keys { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: slide .18s ease-out; }
  @keyframes slide { from { transform: translateX(24px); opacity: .6; } }
}
