﻿:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --panel: #ffffff;
  --panel-soft: #fbf1e7;
  --text: #221b16;
  --muted: #73675f;
  --line: #e5ddd3;
  --x: #151515;
  --note: #20804e;
  --substack: #e66a1f;
  --accent: #375f72;
  --good: #1f7a4d;
  --warn: #a96516;
  --danger: #b84a35;
  --shadow: 0 18px 45px rgba(50, 39, 29, 0.08);
  font-family: Inter, "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fffdf9;
  padding: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(135deg, #151515, #20804e 48%, #e66a1f);
  font-weight: 900;
}
.kicker { margin: 0 0 3px; font-size: 11px; font-weight: 900; color: var(--accent); }
h1, h2, h3, p { margin-top: 0; }
.brand h1 { margin: 0; font-size: 20px; line-height: 1.2; }
.brand span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }

.nav { display: grid; gap: 8px; margin: 20px 0; }
.nav button {
  min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #342923;
  display: flex; align-items: center; justify-content: space-between; padding: 0 10px; font-weight: 800; font-size: 13px;
}
.nav button.active { background: #221b16; color: #fff; border-color: #221b16; }

.sidebar-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--panel); margin-top: 14px; }
.sidebar-card strong { display: block; font-size: 13px; margin-bottom: 6px; }
.sidebar-card p { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 0; }

.main { padding: 18px; min-width: 0; }
.topbar {
  min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 14px 16px; box-shadow: var(--shadow);
}
.topbar h2 { margin: 0; font-size: 22px; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.primary, .secondary {
  min-height: 38px; border-radius: 8px; border: 1px solid transparent; padding: 0 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 13px; font-weight: 900;
}
.primary { background: var(--accent); color: #fff; }
.secondary { background: #fff; color: #312721; border-color: var(--line); }

.score-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.score-card { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 15px; box-shadow: var(--shadow); }
.score-card span { color: var(--muted); font-size: 12px; font-weight: 800; }
.score-card strong { display: block; margin-top: 7px; font-size: 28px; line-height: 1; }
.score-card p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr); gap: 16px; margin-top: 16px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); min-width: 0; }
.panel-head { min-height: 62px; border-bottom: 1px solid var(--line); padding: 13px 15px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.panel-head h3 { margin: 0; font-size: 17px; }
.panel-head p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.panel-body { padding: 14px; }

.channel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.channel { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fff; }
.channel.x { border-top: 4px solid var(--x); }
.channel.note { border-top: 4px solid var(--note); }
.channel.substack { border-top: 4px solid var(--substack); }
.channel h3 { margin: 0; display: flex; align-items: center; justify-content: space-between; font-size: 18px; }
.channel h3 span { font-size: 12px; color: var(--muted); font-weight: 800; }
.channel p { color: var(--muted); font-size: 13px; line-height: 1.55; margin: 9px 0 13px; }
.mini-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mini { border: 1px solid var(--line); border-radius: 8px; padding: 9px; background: #faf9f6; }
.mini span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; }
.mini strong { display: block; margin-top: 4px; font-size: 16px; }

.funnel { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; align-items: stretch; }
.step { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; position: relative; min-height: 92px; }
.step:not(:last-child)::after { content: '→'; position: absolute; right: -17px; top: 35px; color: var(--muted); font-weight: 900; }
.step span { color: var(--muted); font-size: 11px; font-weight: 900; }
.step strong { display: block; margin-top: 5px; font-size: 18px; }
.step p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.35; }

.item-list { display: grid; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; }
.item-top { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.badge { border-radius: 8px; padding: 5px 7px; color: #fff; font-size: 11px; font-weight: 900; }
.badge.x { background: var(--x); }
.badge.note { background: var(--note); }
.badge.substack { background: var(--substack); }
.item h4 { margin: 9px 0 6px; font-size: 15px; line-height: 1.45; }
.item p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.item-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.item-meta span { border: 1px solid var(--line); border-radius: 8px; padding: 5px 7px; font-size: 11px; color: #4d4038; background: #fbfaf7; font-weight: 800; }

.todo { display: grid; gap: 10px; }
.task { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fffaf5; display: grid; gap: 7px; }
.task strong { font-size: 14px; }
.task p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }
.task-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.priority { border-radius: 8px; padding: 4px 7px; font-size: 11px; color: #fff; font-weight: 900; }
.priority.high { background: var(--danger); }
.priority.mid { background: var(--warn); }
.priority.low { background: var(--good); }

.search-box { height: 40px; border: 1px solid var(--line); border-radius: 8px; display: flex; align-items: center; padding: 0 12px; background: #fff; min-width: 240px; }
.search-box input { border: 0; outline: 0; width: 100%; color: var(--text); }
.segment { display: flex; gap: 6px; flex-wrap: wrap; }
.segment button { border: 1px solid var(--line); border-radius: 8px; background: #fff; min-height: 34px; padding: 0 10px; font-size: 12px; font-weight: 900; }
.segment button.active { background: #221b16; color: #fff; border-color: #221b16; }
.hidden { display: none; }

@media (max-width: 1120px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .layout { grid-template-columns: 1fr; }
  .score-grid, .channel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .funnel { grid-template-columns: 1fr; }
  .step:not(:last-child)::after { display: none; }
}

@media (max-width: 720px) {
  .main { padding: 10px; }
  .topbar { align-items: start; flex-direction: column; }
  .score-grid, .channel-grid { grid-template-columns: 1fr; }
  .panel-head { align-items: start; flex-direction: column; }
  .search-box { width: 100%; }
}
