/* タスク詳細（右モーダル） — app.css .card / 他画面に寄せたトーン */
.cm-task-page {
	--td-text: #374151;
	--td-muted: #6c7177;
	--td-subtle: #9ca3af;
	--td-primary: #448aff;
	--td-primary-hover: #307dff;
	--td-primary-soft: #f4f8ff;
	--td-border: #e5e7eb;
	--td-surface: #fff;
	--td-bg: #e8ecef;
	--td-radius: 3px;
	--td-radius-inner: 4px;
	background: var(--td-bg);
	color: var(--td-muted);
	min-height: 100%;
}

.cm-task-page .form-control {
	color: var(--td-text);
}

.cm-task-page .form-control::placeholder {
	color: var(--td-subtle);
}
.cm-task-page__inner {
	padding: 0 0 88px;
	max-width: 720px;
	margin: 0 auto;
}
.cm-task-page .sr-only {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.cm-task-empty {
	text-align: center;
	padding: 48px 24px;
	color: var(--td-muted);
}
.cm-task-empty__icon { font-size: 48px; color: #d1d5db; margin-bottom: 12px; }
.cm-task-empty__title { font-size: 15px; font-weight: 600; margin: 0; color: var(--td-text); }
.cm-task-gallery {
	background: var(--td-surface);
	color: var(--td-text);
	padding: 12px 14px;
	margin: 8px 12px 0;
	border: 1px solid var(--td-border);
	border-radius: var(--td-radius);
}
.cm-task-gallery__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
}
.cm-task-gallery__title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	margin: 0;
}
.cm-task-gallery__title i { opacity: 0.85; }
.cm-task-gallery__count {
	font-size: 12px;
	font-weight: 500;
	color: var(--td-muted);
	background: #f3f4f6;
	padding: 2px 8px;
	border-radius: var(--td-radius);
}
.cm-task-gallery__add-btn {
	border: 1px solid var(--td-border);
	background: #fff;
	color: var(--td-text);
	border-radius: var(--td-radius);
	padding: 5px 12px;
	font-size: 12px;
	font-weight: 600;
	transition: background .15s, border-color .15s, opacity .15s;
}
.cm-task-gallery__add-btn:hover:not(:disabled) {
	background: #f9fafb;
	border-color: #cbd5e1;
	color: var(--td-text);
}
.cm-task-gallery__add-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.cm-task-gallery__drop {
	position: relative;
	border-radius: var(--td-radius-inner);
	transition: box-shadow .2s, background .2s;
}
.cm-task-gallery__drop.is-dragover {
	box-shadow: inset 0 0 0 1px #93c5fd;
	background: var(--td-primary-soft);
}
.cm-task-gallery__track {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	padding-bottom: 4px;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: #cbd5e1 transparent;
}
.cm-task-gallery__track::-webkit-scrollbar { height: 6px; }
.cm-task-gallery__track::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: var(--td-radius);
}
.cm-task-gallery__item {
	flex: 0 0 132px;
	scroll-snap-align: start;
	position: relative;
	border-radius: var(--td-radius-inner);
	overflow: hidden;
	background: #e5e7eb;
	aspect-ratio: 4 / 3;
	border: 1px solid var(--td-border);
	box-shadow: none;
}
.cm-task-gallery__thumb {
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: zoom-in;
}
.cm-task-gallery__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.cm-task-gallery__remove {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 28px;
	height: 28px;
	border: 0;
	border-radius: var(--td-radius);
	background: rgba(55, 65, 81, 0.75);
	color: #fff;
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: background .15s;
}
.cm-task-gallery__remove:hover { background: #c62828; transform: none; }
.cm-task-gallery__slot {
	flex: 0 0 132px;
	scroll-snap-align: start;
	aspect-ratio: 4 / 3;
	border: 1px dashed #cbd5e1;
	border-radius: var(--td-radius-inner);
	background: #f9fafb;
	color: var(--td-muted);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	cursor: pointer;
	transition: border-color .15s, background .15s;
}
.cm-task-gallery__slot:hover {
	border-color: #93c5fd;
	background: var(--td-primary-soft);
	color: var(--td-text);
}
.cm-task-gallery__slot i { font-size: 22px; }
.cm-task-gallery__slot-label {
	font-size: 11px;
	line-height: 1.35;
	text-align: center;
	opacity: 0.9;
}
.cm-task-gallery__overlay,
.cm-task-gallery__drag-hint {
	position: absolute;
	inset: 0;
	border-radius: var(--td-radius-inner);
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	font-size: 13px;
	font-weight: 600;
	z-index: 5;
	pointer-events: none;
}
.cm-task-gallery__overlay:not([hidden]),
.cm-task-gallery__drag-hint:not([hidden]) {
	display: flex;
}
.cm-task-gallery__overlay {
	background: rgba(255, 255, 255, 0.88);
	color: var(--td-text);
}
.cm-task-gallery__drag-hint {
	background: rgba(244, 248, 255, 0.95);
	color: var(--td-primary-hover);
	border: 1px dashed #93c5fd;
}
.cm-task-gallery__drag-hint i { font-size: 28px; }
.cm-task-gallery__spinner {
	width: 32px;
	height: 32px;
	border: 3px solid #e5e7eb;
	border-top-color: var(--td-primary);
	border-radius: 50%;
	animation: cm-task-spin .7s linear infinite;
}
@keyframes cm-task-spin { to { transform: rotate(360deg); } }
.cm-task-context {
	background: var(--td-surface);
	padding: 12px 16px;
	border-bottom: 1px solid var(--td-border);
}
.cm-task-context__row {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 4px 0;
	font-size: 13px;
}
.cm-task-context__label {
	flex: 0 0 20px;
	color: var(--td-subtle);
	text-align: center;
	padding-top: 1px;
}
.cm-task-context__value { color: var(--td-text); }
.cm-task-context__link {
	color: var(--td-primary);
	font-weight: 600;
	text-decoration: none;
	word-break: break-word;
}
.cm-task-context__link:hover { text-decoration: underline; }
.cm-task-card {
	background: var(--td-surface);
	margin: 8px 12px 0;
	padding: 14px 16px;
	border-radius: var(--td-radius);
	border: 1px solid var(--td-border);
	box-shadow: none;
}
.cm-task-card__head {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	color: var(--td-text);
	margin-bottom: 12px;
}
.cm-task-card__head i { color: var(--td-muted); }
.cm-task-field { display: block; margin-bottom: 16px; }
.cm-task-field:last-child { margin-bottom: 0; }
.cm-task-field__label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: var(--td-muted);
	margin-bottom: 6px;
	letter-spacing: 0.02em;
}
.cm-task-field__input--title {
	font-size: 16px;
	font-weight: 600;
	color: var(--td-text);
	padding: 10px 12px;
	border-radius: var(--td-radius);
	border-color: #d1d5db;
}
.cm-task-field__input--title:focus {
	border-color: var(--td-primary);
	box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 0 2px rgba(68, 138, 255, 0.15);
}
.cm-task-field__textarea {
	border-radius: var(--td-radius);
	border-color: #d1d5db;
	resize: vertical;
	min-height: 96px;
}
.cm-task-field__textarea--grow {
	resize: none;
	overflow: hidden;
	min-height: 38px;
	line-height: 1.45;
	padding-top: 8px;
	padding-bottom: 8px;
}
.cm-task-field__textarea:focus {
	border-color: var(--td-primary);
	box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 0 2px rgba(68, 138, 255, 0.15);
}
.cm-task-status-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.cm-task-status-pill {
	margin: 0;
	cursor: pointer;
}
.cm-task-status-pill input { position: absolute; opacity: 0; pointer-events: none; }
.cm-task-status-pill span {
	display: inline-block;
	padding: 6px 12px;
	border-radius: var(--td-radius);
	font-size: 13px;
	font-weight: 600;
	border: 1px solid var(--td-border);
	background: #f9fafb;
	color: var(--td-muted);
	transition: background .15s, border-color .15s, color .15s;
}
.cm-task-status-pill:hover span { border-color: #cbd5e1; background: #f3f4f6; color: var(--td-text); }
.cm-task-status-pill.is-active span {
	background: var(--td-primary);
	border-color: var(--td-primary);
	color: #fff;
	box-shadow: none;
}
.cm-task-status-pill--done.is-active span {
	background: #2e7d32;
	border-color: #2e7d32;
	box-shadow: none;
}
.cm-task-status-pill--muted.is-active span {
	background: var(--td-muted);
	border-color: var(--td-muted);
	box-shadow: none;
}
.cm-task-next-badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background: var(--td-primary-soft);
	color: var(--td-primary-hover);
	border-radius: var(--td-radius);
	font-size: 14px;
	font-weight: 600;
}
.cm-task-due-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}
.cm-task-due-input-wrap {
	position: relative;
	flex: 1 1 160px;
	min-width: 0;
}
.cm-task-due-icon {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--td-subtle);
	pointer-events: none;
}
.cm-task-due-input {
	padding-left: 36px;
	border-radius: var(--td-radius);
	height: 42px;
}
.cm-task-switch {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	cursor: pointer;
	user-select: none;
}
.cm-task-switch input { position: absolute; opacity: 0; }
.cm-task-switch__track {
	width: 44px;
	height: 26px;
	background: #d1d5db;
	border-radius: 999px;
	position: relative;
	transition: background .2s;
}
.cm-task-switch__thumb {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	background: #fff;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0,0,0,0.2);
	transition: transform .2s;
}
.cm-task-switch input:checked + .cm-task-switch__track { background: var(--td-primary); }
.cm-task-switch input:checked + .cm-task-switch__track .cm-task-switch__thumb { transform: translateX(18px); }
.cm-task-switch__text { font-size: 13px; font-weight: 600; color: var(--td-text); }
.cm-task-issue-desc { font-size: 13px; color: var(--td-muted); margin: 0 0 12px; line-height: 1.5; }
.cm-task-issue-desc--warn { color: #b45309; }
.cm-task-issue-state {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 12px;
	background: #fffbeb;
	border: 1px solid #fde68a;
	border-radius: var(--td-radius);
	margin-bottom: 12px;
}
.cm-task-issue-state strong { display: block; font-size: 14px; color: #92400e; }
.cm-task-issue-state p { margin: 4px 0 0; font-size: 12px; color: #a16207; }
.cm-task-issue-state__pulse {
	width: 12px;
	height: 12px;
	margin-top: 4px;
	border-radius: 50%;
	background: #f59e0b;
	flex-shrink: 0;
	animation: cm-task-pulse 1.2s ease-in-out infinite;
}
@keyframes cm-task-pulse {
	0%, 100% { opacity: 1; transform: scale(1); }
	50% { opacity: 0.5; transform: scale(1.15); }
}
.cm-task-issue-btn { border-radius: var(--td-radius); font-weight: 600; }
.cm-task-card--history { padding: 0; overflow: hidden; }
.cm-task-history-toggle {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border: 0;
	background: var(--td-surface);
	font-size: 14px;
	font-weight: 600;
	color: var(--td-text);
	cursor: pointer;
}
.cm-task-history-toggle__chev { transition: transform .2s; color: var(--td-subtle); }
.cm-task-history-toggle[aria-expanded="true"] .cm-task-history-toggle__chev { transform: rotate(180deg); }
.cm-task-history-panel {
	padding: 0 16px 14px;
	border-top: 1px solid #f3f4f6;
	max-height: 240px;
	overflow-y: auto;
}
.cm-task-history-panel[hidden] {
	display: none !important;
}
.cm-task-history-item {
	padding: 10px 0;
	border-bottom: 1px solid #f3f4f6;
}
.cm-task-history-item:last-child { border-bottom: 0; }
.cm-task-history-item__time {
	display: block;
	font-size: 11px;
	color: var(--td-subtle);
	margin-bottom: 2px;
}
.cm-task-history-item__text {
	margin: 0;
	font-size: 13px;
	color: var(--td-muted);
	line-height: 1.45;
}
.cm-task-history-item--new .cm-task-history-item__text { font-weight: 600; color: var(--td-text); }
.cm-task-sticky-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 30;
	display: flex;
	gap: 10px;
	padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
	background: #fff;
	border-top: 1px solid var(--td-border);
	box-shadow: none;
}
.cm-task-sticky-bar__delete {
	flex: 0 0 52px;
	height: 48px;
	border-radius: var(--td-radius);
	padding: 0;
}
.cm-task-sticky-bar__save {
	flex: 1 1 auto;
	height: 48px;
	border-radius: var(--td-radius);
	font-size: 15px;
	font-weight: 600;
}
.cm-task-lightbox {
	position: fixed;
	inset: 0;
	z-index: 10050;
	background: rgba(0,0,0,0.92);
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.cm-task-lightbox:not([hidden]) {
	display: flex;
}
.cm-task-lightbox__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 999px;
	background: rgba(255,255,255,0.12);
	color: #fff;
	font-size: 18px;
	cursor: pointer;
}
.cm-task-lightbox__stage {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: min(100%, 960px);
	min-height: 0;
	padding: 0 52px;
	box-sizing: border-box;
}
.cm-task-lightbox__img {
	max-width: 100%;
	max-height: calc(100vh - 140px);
	object-fit: contain;
	border-radius: var(--td-radius-inner);
	transition: opacity 0.15s ease;
}
.cm-task-lightbox__img.is-changing {
	opacity: 0.35;
}
.cm-task-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 56px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 20px;
	cursor: pointer;
	z-index: 2;
	transition: background 0.15s;
}
.cm-task-lightbox__nav:hover:not(:disabled) {
	background: rgba(255, 255, 255, 0.22);
}
.cm-task-lightbox__nav:disabled {
	opacity: 0.35;
	cursor: default;
}
.cm-task-lightbox__nav--prev {
	left: 12px;
}
.cm-task-lightbox__nav--next {
	right: 12px;
}
.cm-task-lightbox__counter {
	margin: 8px 0 0;
	color: rgba(255, 255, 255, 0.85);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.02em;
}
.cm-task-lightbox__open {
	color: #93c5fd;
	font-size: 14px;
	font-weight: 600;
	margin-top: 12px;
	text-decoration: none;
}
.cm-task-lightbox__open:hover { color: #bfdbfe; }
.cm-task-gallery__item.is-removing {
	opacity: 0;
	transform: scale(0.92);
	transition: opacity .2s, transform .2s;
}
