/* F.クリエイトアプリ — スマホ縦向き優先 */
:root {
  --bg: #eef1f5; --card: #fff; --text: #1f2933; --muted: #6b7785; --line: #e1e4e8;
  --primary: #2457c5; --danger: #c62828; --ok: #1e7a46; --warn: #b26a00; --navy: #1d2b4a;
  /* 注意レベル色 */
  --overdue: #b71c1c; --overdue-bg: #fbd9d9;
  --red: #e53935;     --red-bg: #ffebee;
  --yellow: #f2b100;  --yellow-bg: #fff6d6;
  --blue: #1e88e5;    --blue-bg: #e3f0fd;
  --company: #13897a; --company-bg: #e1f4f1;
  --done: #a3abb5;    --done-bg: #f1f3f5;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; }
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 1.25rem; margin: 0 0 .6rem; } h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .center { text-align: center; }

/* ---------- アプリバー */
.appbar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  height: 52px; padding: 0 4px; padding-top: env(safe-area-inset-top); background: var(--navy); color: #fff; }
.appbar-back { font-size: 2rem; line-height: 1; color: #fff; text-align: center; padding-bottom: 4px; }
.appbar-title { text-align: center; font-weight: 700; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-right { text-align: center; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; font-size: 1.35rem; padding: 4px 10px; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 4px; top: 42px; background: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  min-width: 190px; padding: 6px 0; text-align: left; z-index: 30; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 10px 16px; color: var(--text); font-size: .95rem; }
.menu-pop a:active, .menu-pop button:active { background: #f0f2f5; }
.menu-who { padding: 8px 16px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: .85rem; }

main { max-width: 640px; margin: 0 auto; padding: 12px 12px 90px; }
main.wide-main { max-width: 1000px; }

/* ---------- 共通部品 */
.card { background: var(--card); border-radius: 12px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card-summary { cursor: pointer; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
details[open] > .card-summary { margin-bottom: 10px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
label { display: block; font-size: .82rem; color: var(--muted); }
.field-label { font-size: .82rem; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { font: inherit; font-size: 16px; /* iOSの自動ズーム防止 */ color: var(--text); border: 1px solid #c9ced6;
  border-radius: 8px; padding: 9px 10px; background: #fff; width: 100%; }
label input, label select, label textarea { margin-top: 3px; }
textarea { resize: vertical; }
input:disabled { background: #f3f4f6; color: var(--muted); }
input.num { width: 5.5rem; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inline-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.inline-row input:not(.num) { flex: 1; }
button, .btn { font: inherit; cursor: pointer; border: 1px solid #c9ced6; background: #fff; color: var(--text);
  border-radius: 8px; padding: 9px 14px; display: inline-block; text-align: center; white-space: nowrap; }
button:active, .btn:active { transform: scale(.98); }
button.primary, .btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
button.link { border: 0; background: none; padding: 6px 0; color: var(--primary); }
.danger-text { color: var(--danger) !important; }
.wide { width: 100%; display: block; }
.big-btn { padding: 14px; font-size: 1.05rem; margin-top: 6px; }
.flash { padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; font-size: .92rem; }
.flash.ok { background: #e6f4ea; color: var(--ok); } .flash.error { background: #fdecea; color: var(--danger); }
.tag { background: #ffd54f; color: #4a3500; border-radius: 4px; padding: 0 5px; font-size: .7rem; font-weight: normal; }
.tag.gray { background: #e5e7eb; color: var(--muted); }
.empty { color: var(--muted); margin: 4px 0; }
.seg { display: inline-flex; background: #dfe3e9; border-radius: 9px; padding: 3px; }
.seg a { padding: 5px 14px; border-radius: 7px; color: var(--text); font-size: .88rem; }
.seg a.on { background: #fff; font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.1); }

/* ---------- ログイン */
.card.login { margin-top: 40px; padding: 24px 18px; text-align: center; }
.login form { text-align: left; display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.login-logo { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 16px; background: var(--navy); color: #fff;
  font: 800 2rem/64px Georgia, serif; }

/* ---------- ホーム */
.hello { margin: 4px 2px 14px; color: var(--muted); }
.app-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.app-tile { position: relative; background: var(--card); border-radius: 16px; padding: 16px 6px 12px; display: flex; flex-direction: column;
  align-items: center; gap: 8px; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.07); min-height: 108px; }
.app-tile:active { transform: scale(.97); }
.app-icon { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(160deg, #2a3c66 0%, #16213a 100%);
  box-shadow: 0 4px 10px rgba(22, 33, 58, .35), inset 0 -3px 0 var(--a, #7fb0ff); }
.app-icon .ic-main { stroke: #fff; stroke-width: 1.8; }
.app-icon .ic-accent { stroke: var(--a, #7fb0ff); stroke-width: 2; }
.app-icon .ic-solid { fill: #fff; stroke: none; }
.app-icon .ic-cut { fill: #1d2a4a; stroke: none; }
.app-icon .ic-accent-fill { fill: var(--a, #7fb0ff); stroke: none; }
.app-icon .ic-outline { fill: #1d2a4a; stroke: #1d2a4a; stroke-width: 2.6; }
.app-icon .ic-cut-line { fill: none; stroke: #1d2a4a; stroke-width: 1.3; }
.app-icon .ic-side { fill: #c3cde2; stroke: none; }
.app-name { font-size: .86rem; font-weight: 700; text-align: center; line-height: 1.3; }
.app-badge { position: absolute; top: 8px; right: 10px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--red); color: #fff; font-size: .78rem; font-weight: 700; line-height: 22px; text-align: center; }
.app-tile.soon { opacity: .5; }
.app-tile.soon .app-icon { filter: saturate(.5); }
.app-soon { position: absolute; top: 8px; right: 8px; font-size: .62rem; background: #e5e7eb; color: var(--muted); border-radius: 4px; padding: 0 4px; }

/* ---------- タスクボード (左右2列) */
.board-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.mini-stat { background: #fff; border-radius: 9px; padding: 5px 10px; font-size: .82rem; color: var(--text); }
.mini-stat strong { font-size: 1rem; color: var(--company); }
.mini-stat.alert strong { color: var(--warn); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0 2px 10px; font-size: .72rem; color: var(--muted); }
.lg::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 3px; vertical-align: -1px; background: var(--k); }
.lg.u-overdue { --k: var(--overdue); } .lg.u-red { --k: var(--red); } .lg.u-yellow { --k: var(--yellow); }
.lg.u-blue { --k: var(--blue); } .lg.u-company { --k: var(--company); } .lg.u-done { --k: var(--done); }

.board { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
.col { min-width: 0; }
.col-head { border-radius: 10px; padding: 7px 8px; margin-bottom: 6px; color: #fff; }
.col-billable .col-head { background: #4a3a8c; }
.col-company .col-head { background: #11796c; }
.col-title { font-weight: 700; font-size: .95rem; }
.col-sub { font-size: .68rem; opacity: .9; }
.col-empty { font-size: .78rem; color: var(--muted); text-align: center; margin: 8px 0; }
.col-divider { display: flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--muted); margin: 14px 0 6px; }
.col-divider::before, .col-divider::after { content: ""; flex: 1; height: 1px; background: #c9ced6; }

.tcard { display: block; background: var(--bg-u); border-left: 6px solid var(--k); border-radius: 8px; padding: 7px 8px;
  margin-bottom: 6px; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.tcard:active { filter: brightness(.95); }
.tno { display: flex; justify-content: space-between; gap: 4px; font-size: .7rem; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.tlabel { font-style: normal; font-weight: 700; color: var(--k); overflow: hidden; text-overflow: ellipsis; }
.ttitle { font-size: .9rem; font-weight: 700; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.u-overdue { --k: var(--overdue); --bg-u: var(--overdue-bg); }
.u-red     { --k: var(--red);     --bg-u: var(--red-bg); }
.u-yellow  { --k: var(--yellow);  --bg-u: var(--yellow-bg); }
.u-yellow .tlabel, .due-box.u-yellow em { color: #9a6d00; }
.u-blue    { --k: var(--blue);    --bg-u: var(--blue-bg); }
.u-company { --k: var(--company); --bg-u: var(--company-bg); }
.u-done    { --k: var(--done);    --bg-u: var(--done-bg); }
.tcard.u-done .ttitle { color: var(--muted); font-weight: normal; text-decoration: line-through; text-decoration-color: #c4cad1; }
.tcard.u-overdue { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px rgba(183,28,28,.35); } }

/* 配信ボタン (社内タスク見出しの右上) */
.col-head { position: relative; }
.col-head { padding-right: 46px; }
.col-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.add-btn { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 50%; background: #fff;
  font-size: 1.5rem; font-weight: 700; line-height: 33px; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.add-btn:hover { text-decoration: none; }
.add-btn:active { transform: scale(.92); }
.col-billable .add-btn { color: #4a3a8c; }
.col-company .add-btn { color: var(--company); }

/* ---------- タスク詳細 */
.task-head { border-left: 8px solid var(--k); background: var(--bg-u); }
.th-no { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; display: flex; justify-content: space-between; }
.th-kind { font-size: .75rem; background: #fff; border-radius: 6px; padding: 0 6px; }
.th-title { font-size: 1.2rem; margin: 2px 0 4px; }
.th-state { font-size: .85rem; font-weight: 700; color: var(--k); }
.u-yellow .th-state { color: #9a6d00; }
.sec { font-size: .95rem; border-bottom: 2px solid var(--line); padding-bottom: 6px; }
.due-box { display: flex; align-items: baseline; gap: 10px; background: var(--bg-u); border-left: 5px solid var(--k); border-radius: 8px; padding: 8px 10px; }
.due-box span { font-size: .8rem; color: var(--muted); }
.due-box strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.due-box em { font-style: normal; font-weight: 700; color: var(--k); margin-left: auto; }
.desc { white-space: pre-wrap; background: #f8f9fb; border-radius: 8px; padding: 10px; word-break: break-word; }
.meta { display: grid; grid-template-columns: 6.5em 1fr; gap: 6px 10px; margin: 12px 0; font-size: .92rem; }
.meta dt { color: var(--muted); font-size: .82rem; } .meta dd { margin: 0; }
.pts { font-weight: 700; color: var(--company); } .pts.neg { color: var(--danger); }
.exec { border-top: 4px solid var(--company); }
.award { background: #e6f4ea; color: var(--ok); border-radius: 8px; padding: 10px; margin: 10px 0; }
.approve-box { background: #fff8e6; border-radius: 10px; padding: 10px; margin-top: 12px; }
.comment { border-bottom: 1px solid var(--line); padding: 8px 0; }
.c-head { font-size: .85rem; } .c-body { white-space: pre-wrap; word-break: break-word; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }

/* 写真 */
.photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 6px 0; }
.photos:empty { display: none; }
.photo { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: #e5e7eb; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; padding: 0;
  background: rgba(0,0,0,.6); color: #fff; border: 0; font-size: 1.1rem; line-height: 30px; }
.photo-pick { display: block; border: 2px dashed #b8c0cc; border-radius: 10px; padding: 14px; text-align: center; color: var(--primary); cursor: pointer; }
.photo-pick input { display: none; }
.kind-note { border-radius: 8px; padding: 8px 10px; font-size: .85rem; margin-top: 0; }
.kind-note.kind-billable { background: #efeaf9; color: #4a3a8c; }
.kind-note.kind-company { background: var(--company-bg); color: #0d6358; }

/* ---------- ポイント */
.year-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.big strong { font-size: 2rem; color: var(--company); }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; height: 160px; align-items: end; }
.bar { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; color: var(--text); }
.bar .fill { width: 78%; background: #9fd3ca; border-radius: 4px 4px 0 0; min-height: 2px; }
.bar.on .fill { background: var(--company); }
.bar .val { font-size: .68rem; font-weight: 700; }
.bar .lbl { font-size: .7rem; color: var(--muted); margin-top: 2px; }
.hist { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hist .pts { font-size: 1.05rem; white-space: nowrap; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; }
table.matrix { border-collapse: collapse; font-size: .85rem; min-width: 100%; }
.matrix th, .matrix td { padding: 7px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.matrix th { font-size: .75rem; color: var(--muted); font-weight: 600; }
.matrix .sticky { position: sticky; left: 0; background: #fff; text-align: left; box-shadow: 1px 0 0 var(--line); }
.matrix .sub { font-size: .7rem; color: var(--muted); }
.matrix .zero { color: #c4cad1; }
.matrix .total { font-weight: 700; color: var(--company); background: #f3faf8; }
.matrix tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.approve-card .ap-title { display: block; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.user-card.inactive { opacity: .6; }

@media (min-width: 700px) {
  .app-grid { grid-template-columns: repeat(4, 1fr); }
  .board { gap: 16px; }
  .tcard { padding: 9px 12px; }
  .photos { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- 対応者指名 (選択ボタン + モーダル) */
.picker { width: 100%; display: flex; justify-content: space-between; align-items: center; text-align: left;
  font-size: 16px; padding: 10px 12px; margin-top: 3px; border-radius: 8px; }
.picker-arrow { color: var(--muted); font-size: 1.3rem; line-height: 1; }
.modal { border: 0; border-radius: 14px; padding: 0; width: min(92vw, 420px); max-height: 80vh; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.modal[open] { display: flex; flex-direction: column; }
.modal::backdrop { background: rgba(15, 23, 42, .45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.05rem; }
.modal-close { border: 0; background: none; font-size: 1.6rem; line-height: 1; padding: 2px 8px; color: var(--muted); }
.pick-list { list-style: none; margin: 0; padding: 6px 0; overflow-y: auto; }
.pick { width: 100%; border: 0; border-radius: 0; background: none; text-align: left; padding: 12px 44px 12px 16px;
  position: relative; display: block; white-space: normal; }
.pick:active { background: #f0f2f5; transform: none; }
.pick-name { display: block; font-weight: 700; }
.pick-sub { display: block; font-size: .8rem; color: var(--muted); }
.pick.on { background: #eef3fd; }
.pick.on::after { content: "✓"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--primary); font-weight: 700; font-size: 1.1rem; }
.pick-list li + li .pick { border-top: 1px solid var(--line); }

/* ---------- タスク詳細 最下部 (戻る・削除) */
.bottom-actions { display: flex; gap: 10px; align-items: stretch; margin: 4px 0 8px; }
.bottom-actions .back-btn { flex: 1; padding: 13px 10px; font-weight: 700; color: var(--primary); border-color: var(--primary); }
.bottom-actions .back-btn:hover { text-decoration: none; }
.bottom-actions form { display: flex; }
.bottom-actions .delete-btn { padding: 13px 14px; color: var(--danger); border-color: #e8b4b4; background: #fff; }

/* ---------- スマホで使う */
.qr { display: inline-block; background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--line); }
.qr svg { display: block; width: 220px; height: 220px; }
.phone-url { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary); word-break: break-all; margin: 2px 0 8px; user-select: all; }
.howto { padding-left: 1.3em; margin: 6px 0; } .howto li { margin: 6px 0; }
