/* 会社コントロールセンター — 構造CSS（色はテーマ変数のみ参照） */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --r: 18px; --r-sm: 13px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --tap: 44px;
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font, -apple-system, "SF Pro Text", "Hiragino Sans", system-ui, sans-serif);
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5; letter-spacing: .005em;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
#app { max-width: 540px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); position: relative; }

/* ---- topbar ---- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px calc(14px - 2px);
  background: var(--bar-bg); backdrop-filter: saturate(1.4) blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow); }
.top-live { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  color: var(--text2); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--live);
  box-shadow: 0 0 0 0 var(--live-glow); animation: pulse 2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--live-glow); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---- main / tab ---- */
#main { padding: 16px 14px 96px; }
.view { display: flex; flex-direction: column; gap: 16px; }
.view-hint { font-size: 12.5px; color: var(--text3); padding: 0 2px; }

.tabbar {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 540px; z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--bar-bg); backdrop-filter: saturate(1.4) blur(18px);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-height: var(--tap); padding: 6px 0; border-radius: 12px;
  font-size: 10.5px; font-weight: 600; color: var(--text3);
  transition: color .2s, background .2s; }
.tab .tico { font-size: 17px; line-height: 1; }
.tab.on { color: var(--accent); }
.tab.on .tico { filter: drop-shadow(0 0 8px var(--accent-glow)); }

/* ---- reveal anim (下→上スライド) ---- */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.in { opacity: 1; transform: none;
  transition: opacity .26s var(--ease) var(--d,0ms), transform .26s var(--ease) var(--d,0ms); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .pulse { animation: none; }
}

/* ---- 収益ヒーロー ---- */
.rev-hero {
  border-radius: var(--r); padding: 20px; position: relative; overflow: hidden;
  background: var(--hero-bg); border: 1px solid var(--hero-line);
  box-shadow: var(--shadow);
}
.rev-head { display: flex; justify-content: space-between; align-items: center; }
.rev-month { font-size: 13px; font-weight: 600; color: var(--text2); }
.rev-live { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text3); }
.rev-amount { font-size: 40px; font-weight: 800; letter-spacing: -.03em; margin: 8px 0 14px;
  font-variant-numeric: tabular-nums; color: var(--text); }
.rev-of { font-size: 17px; font-weight: 600; color: var(--text3); }
.rev-bar { height: 9px; border-radius: 99px; background: var(--track); overflow: hidden; }
.rev-fill { height: 100%; border-radius: 99px; width: 0;
  background: var(--accent-grad); box-shadow: 0 0 14px var(--accent-glow);
  transition: width 1s var(--ease); }
.rev-foot { display: flex; justify-content: space-between; margin-top: 10px;
  font-size: 12px; color: var(--text2); }
.rev-foot b { color: var(--accent); font-weight: 700; }

/* ---- stat grid ---- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card { display: flex; flex-direction: column; gap: 1px; padding: 15px 16px;
  border-radius: var(--r-sm); background: var(--card); border: 1px solid var(--line);
  position: relative; overflow: hidden; }
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--sc, var(--accent)); }
.stat-ico { font-size: 15px; }
.stat-n { font-size: 30px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; }
.stat-l { font-size: 13px; font-weight: 700; }
.stat-sub { font-size: 10.5px; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; }
.stat-owner { --sc: var(--c-owner); }
.stat-block { --sc: var(--c-block); }
.stat-live  { --sc: var(--live); }
.stat-pj    { --sc: var(--accent); }

/* ---- block / section ---- */
.block { display: flex; flex-direction: column; gap: 9px; }
.block-h { display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 700; letter-spacing: -.01em; padding: 0 2px; }
.badge { font-size: 11px; font-weight: 700; color: var(--bg);
  background: var(--accent); border-radius: 99px; padding: 2px 9px; min-width: 22px; text-align: center; }

/* owner item */
.owner-item { display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 13px 15px; border-radius: var(--r-sm); width: 100%;
  background: var(--owner-bg); border: 1px solid var(--c-owner-line);
  transition: transform .15s var(--ease), filter .2s; }
.owner-item:active { transform: scale(.985); }
.owner-pj { font-size: 11.5px; font-weight: 700; color: var(--c-owner); }
.owner-task { font-size: 14px; font-weight: 600; }
.owner-act { font-size: 12px; color: var(--text2); }

/* pj row */
.pj-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 13px 14px; border-radius: var(--r-sm); background: var(--card);
  border: 1px solid var(--line); transition: transform .15s var(--ease), background .2s; }
.pj-row:active { transform: scale(.985); }
.pj-emoji { font-size: 22px; flex: none; }
.pj-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.pj-top { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.pj-biz { font-size: 9.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text3); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.pj-now { font-size: 12px; color: var(--text2); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.pj-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.sig { font-size: 10.5px; font-weight: 700; border-radius: 99px; padding: 3px 9px; white-space: nowrap; }
.sig-doing { color: var(--c-doing); background: var(--c-doing-bg); }
.sig-owner { color: var(--c-owner); background: var(--owner-bg); }
.sig-hold  { color: var(--text3); background: var(--track); }
.health { width: 8px; height: 8px; border-radius: 50%; }
.h-good { background: var(--live); box-shadow: 0 0 8px var(--live-glow); }
.h-watch { background: var(--c-owner); }
.h-stop { background: var(--c-block); }

/* ---- kanban ---- */
.view-kanban { gap: 12px; }
.kanban { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.kanban::-webkit-scrollbar { display: none; }
.kcol { flex: 0 0 78%; max-width: 300px; scroll-snap-align: start;
  background: var(--col-bg); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px; display: flex; flex-direction: column; gap: 9px; }
.kcol-h { display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 700; padding: 2px 2px 8px; border-bottom: 1px solid var(--line); }
.kcount { font-size: 11px; font-weight: 700; color: var(--text3);
  background: var(--track); border-radius: 99px; padding: 1px 8px; }
.kcol-body { display: flex; flex-direction: column; gap: 9px; min-height: 40px; }
.kempty { font-size: 13px; color: var(--text3); text-align: center; padding: 14px 0; }
.kcard { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px 13px;
  border-radius: var(--r-sm); background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--kc, var(--accent));
  transition: transform .15s var(--ease); }
.kcard:active { transform: scale(.98); }
.kcard-pj { font-size: 11px; font-weight: 700; color: var(--text2); }
.kcard-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.kcard-note { font-size: 11.5px; color: var(--text3); }
.kcard-owner { font-size: 11.5px; color: var(--c-owner); }
.kcard-ms { font-size: 10px; color: var(--text3); margin-top: 2px; }
.s-todo  { --kc: var(--c-todo); }  .s-todo  .kcol-h { color: var(--c-todo); }
.s-doing { --kc: var(--c-doing); } .s-doing .kcol-h { color: var(--c-doing); }
.s-owner { --kc: var(--c-owner); } .s-owner .kcol-h { color: var(--c-owner); }
.s-done  { --kc: var(--c-done); }  .s-done  .kcol-h { color: var(--c-done); }
.s-hold  { --kc: var(--c-hold); }  .s-hold  .kcol-h { color: var(--c-hold); }

/* ---- milestones ---- */
.ms-pj { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px; display: flex; flex-direction: column; gap: 13px; }
.ms-pj-h { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.ms { display: flex; flex-direction: column; gap: 7px; }
.ms-h { display: flex; align-items: center; justify-content: space-between; }
.ms-name { font-size: 13px; font-weight: 600; }
.ms-prog { font-size: 11px; font-weight: 700; color: var(--text3); font-variant-numeric: tabular-nums; }
.ms-seg { display: flex; gap: 4px; }
.seg { height: 6px; flex: 1; border-radius: 99px; background: var(--track); }
.seg.s-todo  { background: var(--track); }
.seg.s-doing { background: var(--c-doing); box-shadow: 0 0 8px var(--c-doing-bg); }
.seg.s-owner { background: var(--c-owner); }
.seg.s-done  { background: var(--c-done); }
.seg.s-hold  { background: var(--c-hold); }
.ms-task { font-size: 12.5px; padding: 7px 11px; border-radius: 10px; background: var(--track);
  display: flex; gap: 6px; }
.ms-task.s-doing { background: var(--c-doing-bg); color: var(--c-doing); font-weight: 600; }
.ms-task.s-owner { background: var(--owner-bg); color: var(--c-owner); font-weight: 600; }

/* ---- rooms ---- */
.room-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.room-card { display: flex; flex-direction: column; gap: 5px; text-align: left; padding: 15px;
  border-radius: var(--r-sm); background: var(--card); border: 1px solid var(--line);
  transition: transform .15s var(--ease); }
.room-card:active { transform: scale(.98); }
.room-live { display: inline-flex; }
.room-name { font-size: 14px; font-weight: 700; }
.room-now { font-size: 11.5px; color: var(--text2); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- PJ detail ---- */
.view-pj { gap: 14px; }
.back { align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--text2);
  padding: 6px 0; }
.pj-head { display: flex; flex-direction: column; gap: 13px; }
.pj-head-top { display: flex; gap: 13px; align-items: center; }
.pj-head-emoji { font-size: 38px; }
.pj-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.pj-tag { font-size: 13px; color: var(--text2); }
.pj-head-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.chip { font-size: 11px; font-weight: 600; color: var(--text2); border: 1px solid var(--line);
  border-radius: 99px; padding: 3px 10px; }
.health-pill { font-size: 10.5px; font-weight: 700; border-radius: 99px; padding: 3px 10px; }
.health-pill.h-good { color: var(--live); background: var(--c-doing-bg); }
.health-pill.h-watch { color: var(--c-owner); background: var(--owner-bg); }
.health-pill.h-stop { color: var(--c-block); background: var(--block-bg); }
.pj-now-box, .pj-blocker { border-radius: var(--r-sm); padding: 14px 15px;
  display: flex; flex-direction: column; gap: 4px; }
.pj-now-box { background: var(--card); border: 1px solid var(--line); }
.pj-blocker { background: var(--block-bg); border: 1px solid var(--c-block-line); }
.pj-now-box .lbl, .pj-blocker .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text3); }
.pj-blocker .lbl { color: var(--c-block); }
.pj-now-box p { font-size: 14px; }
.pj-blocker p { font-size: 13.5px; color: var(--text); }
.pj-ms { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; display: flex; flex-direction: column; gap: 9px; }
.pj-ms-h { display: flex; align-items: center; justify-content: space-between; font-size: 14px;
  font-weight: 700; }
.task { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: none; }
.task-dot { font-size: 14px; flex: none; line-height: 1.5; }
.task-body { display: flex; flex-direction: column; gap: 3px; }
.task-title { font-size: 14px; }
.task.s-done .task-title { color: var(--text3); text-decoration: line-through; text-decoration-color: var(--line); }
.task-note { font-size: 12px; color: var(--text2); }
.task-owner { font-size: 12px; color: var(--c-owner); font-weight: 600; }

@media (min-width: 720px) {
  #app { max-width: 920px; }
  .tabbar { max-width: 920px; }
  #main { padding: 22px 22px 96px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .room-grid { grid-template-columns: repeat(3, 1fr); }
  .kcol { flex-basis: 320px; }
  .view-pj, .view { display: grid; }
}
