/* ==============================
   CPM 共通デザイン
   やさしい保育ICT風
============================== */

/* 全画面で共有するデザイン規格 */
:root {
	--color-primary: #25637a;
	--color-text: #334155;
	--color-muted: #64748b;
	--color-surface: #ffffff;
	--color-border: #e5f3fb;
	--color-control-border: #dbeafe;
	--radius-card: 20px;
	--radius-control: 14px;
	--shadow-card: 0 8px 24px rgba(80, 120, 150, 0.12);
	--shadow-hover: 0 12px 28px rgba(80, 120, 150, 0.18);
	--header-height: 68px;
	--cart-sidebar-width: 286px;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

/* 全体 */
body {
	margin: 0;
	padding-top: var(--header-height);
	background: linear-gradient(180deg, #f4fbff 0%, #ffffff 100%);
	color: #334155;
	font-family: "Yu Gothic", "Hiragino Sans", "Meiryo", sans-serif;
	font-size: 16px;
	line-height: 1.6;
}

/* ページ中央 */
.container {
	width: 90%;
	max-width: 1100px;
	margin: 0 auto;
	padding: 28px 0 40px;
}

/* ==============================
   ヘッダー
============================== */

/* ヘッダー全体 */
.header {
	height: var(--header-height);
	padding: 0 28px;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	width: 100%;
	z-index: 900;

	background: #ffffff;
	border-bottom: 1px solid #e5e7eb;

	display: flex;
	align-items: center;

	box-sizing: border-box;
}

/* 左側ロゴ */
.header-logo {
	font-size: 22px;
	font-weight: 700;
	letter-spacing: 0.8px;
	color: #111827;
	text-decoration: none;
}

/* 右側アイコンエリア */
.header-right {
	margin-left: auto;

	display: flex;
	align-items: center;
	gap: 12px;
}

/* 共通アイコン */
.header-icon {
	display: block;
	width: 32px;
	height: 32px;
	
	transition: transform 0.2s ease;
}

/* 未処理バッジ*/
.header-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 6px;
	margin-left: 6px;
	background: #ef4444;
	color: white;
	border-radius: 999px;
	font-size: 12px;
	font-weight: bold;
	line-height: 1;
}

/* ==============================
   印刷カート
============================== */

/* 印刷カート */
.header-cart {
	position: relative;

	width: 44px;
	height: 44px;

	display: flex;
	align-items: center;
	justify-content: center;

	text-decoration: none;
	border-radius: 8px;
}

/* 印刷カート hover時にアイコン拡大 */
.header-cart:hover .header-icon {
	transform: scale(1.12);
}

/* カート件数バッジ */
.cart-count,
.menu-badge {
	position: absolute;
	top: 0;
	right: 0;

	min-width: 18px;
	height: 18px;
	padding: 0 5px;

	border-radius: 999px;
	background: #ff6b35;
	color: #ffffff;

	display: flex;
	align-items: center;
	justify-content: center;

	font-size: 11px;
	font-weight: bold;
	line-height: 1;

	z-index: 2;
}

/* ==============================
   ハンバーガーメニュー
============================== */

/* チェックボックスは非表示 */
.menu-toggle {
	display: none;
}

/* ハンバーガーメニュー */
.menu-wrap {
	position: relative;
}

.menu-button {
	width: 44px;
	height: 44px;

	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	
	position: relative;
}

/* ハンバーガーメニュー hover時にアイコン拡大 */
.menu-button:hover .header-icon {
	transform: scale(1.12);
}

/* メニュー本体 */
.menu-panel {
	position: absolute;
	top: 46px;
	right: 0;

	width: 190px;
	padding: 8px 0;

	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: var(--radius-control);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);

	display: none;
	z-index: 100;
}

/* メニューリンク */
.menu-panel a {
	display: block;
	padding: 12px 18px;

	color: #111827;
	text-decoration: none;
	font-size: 14px;
	font-weight: bold;
}

/* メニューリンク hover */
.menu-panel a:hover {
	background: #f3f4f6;
}

/* チェックされたらメニュー表示 */
.menu-toggle:checked ~ .menu-panel {
	display: block;
}

/* ==============================
   選択中プリントの固定表示
============================== */

body.cart-sidebar-visible {
	padding-right: var(--cart-sidebar-width);
}

.cart-sidebar {
	position: fixed;
	top: var(--header-height);
	right: 0;
	bottom: 0;
	z-index: 850;
	width: var(--cart-sidebar-width);
	padding: 16px;
	background: #ffffff;
	border-left: 1px solid var(--color-border);
	box-shadow: -8px 0 24px rgba(80, 120, 150, 0.12);
	display: flex;
	flex-direction: column;
	gap: 12px;
	overflow: hidden;
}

.cart-sidebar[hidden],
.cart-sidebar-mobile-bar[hidden] {
	display: none !important;
}

.cart-sidebar-heading {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--color-border);
	font-weight: bold;
	color: var(--color-primary);
}

.cart-sidebar-heading strong {
	flex: 0 0 auto;
	white-space: nowrap;
}

.cart-sidebar-groups {
	flex: 1;
	overflow-y: auto;
	padding-right: 4px;
}

.cart-sidebar-group + .cart-sidebar-group {
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid var(--color-border);
}

.cart-sidebar-group h2 {
	margin: 0;
	text-align: left;
	font-size: 15px;
}

.cart-sidebar-group h2 a {
	color: var(--color-primary);
	text-decoration: none;
}

.cart-sidebar-student-heading {
	display: grid;
	gap: 3px;
	margin-bottom: 8px;
}

.cart-sidebar-student-summary {
	font-size: 12px;
	line-height: 1.45;
	color: var(--color-muted);
	overflow-wrap: anywhere;
}

.cart-sidebar-items {
	display: grid;
	gap: 8px;
}

.cart-sidebar-item {
	display: grid;
	grid-template-columns: 52px minmax(0, 1fr) 30px;
	gap: 10px;
	align-items: center;
	min-height: 66px;
	padding: 7px;
	background: #f8fcff;
	border: 1px solid var(--color-border);
	border-radius: 12px;
}

.cart-sidebar-item img,
.cart-sidebar-pdf {
	width: 52px;
	height: 52px;
	object-fit: contain;
	background: #ffffff;
	border-radius: 8px;
}

.cart-sidebar-pdf {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: bold;
	color: var(--color-muted);
}

.cart-sidebar-item-text {
	min-width: 0;
	display: grid;
	gap: 2px;
}

.cart-sidebar-item-text strong {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 13px;
	color: var(--color-text);
}

.cart-sidebar-item-text span {
	font-size: 11px;
	color: var(--color-muted);
}

.cart-sidebar-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #9aadb9;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.cart-sidebar-remove:hover {
	background: transparent;
	color: #708895;
}

.cart-sidebar-remove:focus-visible {
	outline: 2px solid rgba(112, 136, 149, 0.3);
	outline-offset: 2px;
}

.cart-sidebar-remove:disabled {
	opacity: 0.5;
	cursor: wait;
}

.cart-sidebar-link,
.cart-sidebar-mobile-bar {
	text-decoration: none;
	font-weight: bold;
}

.cart-sidebar-link {
	display: block;
	padding: 10px 14px;
	text-align: center;
	color: #ffffff;
	background: var(--color-primary);
	border-radius: var(--radius-control);
}

.cart-sidebar-mobile-bar {
	display: none;
}

/* ==============================
   カード
============================== */

.card {
	background: var(--color-surface);
	border-radius: var(--radius-card);
	padding: 22px;
	margin-bottom: 20px;
	border: 1px solid var(--color-border);
	box-shadow: var(--shadow-card);
}

/* ==============================
   見出し
============================== */

h1,
h2 {
	text-align: center;
	color: var(--color-primary);
	margin: 0 0 24px;
}

.page-title {
	font-size: 28px;
	font-weight: bold;
	margin: 0 0 24px;
	color: var(--color-primary);
}

/* ==============================
   ボタン
============================== */

.btn,
.student-register-btn,
.page-btn,
.open-candidate-modal {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 11px 20px;
	margin: 0;
	border-radius: 999px;
	border: none;

	background: #5bb8e8;
	color: #ffffff;

	text-decoration: none;
	font-weight: bold;
	font-size: 15px;
	text-align: center;

	cursor: pointer;
	box-sizing: border-box;

	box-shadow: 0 4px 12px rgba(80, 120, 150, 0.16);
	transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn:hover,
.student-register-btn:hover,
.page-btn:hover,
.open-candidate-modal:hover {
	opacity: 0.92;
	transform: translateY(-2px);
	box-shadow: 0 8px 18px rgba(80, 120, 150, 0.2);
}

/* メイン操作 */
.btn-main {
	background: #5bb8e8;
	min-width: 160px;
}

/* 戻る・補助操作 */
.btn-sub,
.btn-sub-main {
	background: #8fd6b3;
}

/* アクセント操作 */
.btn-accent {
	background: #f6b26b;
}

/* 削除・危険操作 */
.btn-danger,
.btn-delete {
	background: #f28b82;
}

/* 小さい削除ボタン */
.btn-delete {
	min-width: 80px;
	padding: 7px 13px;
	font-size: 13px;
}

/* submit */
input[type="submit"] {
	min-width: 220px;
}

/* ==============================
   Home画面
============================== */

.home-menu {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin: 24px 0 28px;
}

/* 児童カードリンク */
.student-card-link {
	display: block;
	color: inherit;
	text-decoration: none;
}

/* 児童カード */
.student-card {
	position: relative;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

/* カード全体を押せる透明なPOSTボタン */
.student-card-submit {
	position: absolute;
	inset: 0;
	z-index: 1;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	border-radius: inherit;
	background: transparent;
	cursor: pointer;
}

.student-card-submit:focus-visible {
	outline: 3px solid var(--color-primary);
	outline-offset: 3px;
}

.student-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 12px 28px rgba(80, 120, 150, 0.18);
}

/* 児童一覧情報 */
.student-info {
	text-align: center;
}

/* 児童名 */
.student-card .student-name,
.student-info p:first-child {
	margin: 0 0 8px;
	font-size: 22px;
	font-weight: bold;
	color: #25637a;
}

/* 年齢・性別 */
.student-meta,
.student-info p:last-child {
	margin: 0;
	font-size: 15px;
	color: #64748b;
}

.home-container {
	background: transparent;
}

.home-page .container {
	min-height: calc(100vh - 84px);
}

.home-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
}

.home-toolbar .breadcrumb {
	display: inline-flex;
	align-items: center;
	min-height: 46px;
	margin: 0;
}

/* 児童一覧の検索・絞り込み */
.student-list-tools {
	margin-bottom: 0;
	padding: 0;
	background: transparent;
	border: 0;
	box-shadow: none;
}

.student-tools-row {
	display: flex;
	align-items: center;
	justify-content: flex-end;
}

.student-search-control {
	grid-column: 1 / -1;
	min-width: 0;
}

.student-filter-control {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.student-filter-control label {
	margin: 0;
	font-size: 13px;
}

.student-filter-control input,
.student-filter-control select {
	width: 100%;
	max-width: none;
	margin: 0;
}

.student-filter-reset {
	min-width: 96px;
	margin: 0;
}

.student-sort-menu {
	position: relative;
	flex: 0 0 auto;
}

.student-sort-menu summary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 46px;
	padding: 0 16px;
	border: 2px solid var(--color-primary);
	border-radius: 10px;
	background: #f4fbff;
	box-shadow: 0 2px 6px rgba(37, 99, 122, 0.1);
	color: var(--color-primary);
	font-size: 14px;
	font-weight: bold;
	line-height: 1;
	list-style: none;
	cursor: pointer;
	user-select: none;
}

.student-sort-menu summary::before {
	content: "⇅";
	font-size: 17px;
	font-weight: bold;
	line-height: 1;
}

.student-sort-menu summary::-webkit-details-marker {
	display: none;
}

.student-sort-menu summary::after {
	content: "▼";
	font-size: 9px;
	transition: transform 0.18s ease;
}

.student-sort-menu[open] summary::after {
	transform: rotate(180deg);
}

.student-sort-menu summary:hover {
	background: #eaf7ff;
	box-shadow: 0 4px 10px rgba(37, 99, 122, 0.16);
}

.student-sort-popover {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 20;
	display: grid;
	grid-template-columns: repeat(3, minmax(120px, 1fr));
	gap: 12px;
	width: min(520px, calc(100vw - 32px));
	padding: 16px;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-control);
	box-shadow: 0 14px 34px rgba(80, 120, 150, 0.22);
}

.student-sort-popover .student-filter-reset {
	grid-column: 1 / -1;
	justify-self: end;
	min-height: 40px;
	padding: 8px 16px;
	border: 2px solid var(--color-primary);
	border-radius: 10px;
	background: #f4fbff;
	box-shadow: 0 2px 6px rgba(37, 99, 122, 0.1);
	color: var(--color-primary);
}

.student-sort-popover .student-filter-reset::before {
	content: "↻";
	margin-right: 7px;
	font-size: 17px;
	font-weight: bold;
	line-height: 1;
}

.student-sort-popover .student-filter-reset:hover {
	background: #eaf7ff;
	border-color: var(--color-primary);
	box-shadow: 0 4px 10px rgba(37, 99, 122, 0.16);
	color: var(--color-primary);
}

.student-filter-status {
	grid-column: 1 / -1;
	min-height: 22px;
	margin: 0;
	color: var(--color-muted);
	font-size: 13px;
	font-weight: bold;
	text-align: left;
}

.student-card-link {
	transition: opacity 0.18s ease;
}

/* display:blockより優先し、絞り込み対象外を確実に非表示にする */
.student-card-link[hidden] {
	display: none;
}

.student-card-link.search-secondary {
	opacity: 0.42;
}

.student-card-link.search-secondary:hover,
.student-card-link.search-secondary:focus-visible {
	opacity: 0.75;
}

.student-filter-empty {
	text-align: center;
}

/* ==============================
   フォーム
============================== */

input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="date"],
input[type="file"],
textarea,
select {
	width: 100%;
	max-width: 500px;
	padding: 12px 14px;
	margin: 8px 0 16px;

	min-height: 46px;
	border: 1px solid var(--color-control-border);
	border-radius: var(--radius-control);
	background: var(--color-surface);

	color: #334155;
	font-size: 16px;
	box-sizing: border-box;
}

input:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: #74c7ee;
	box-shadow: 0 0 0 4px rgba(116, 199, 238, 0.18);
}

textarea {
	resize: vertical;
}

label {
	display: inline-block;
	margin-bottom: 6px;
	color: #475569;
	font-weight: bold;
}

/* フォーム行 */
.form-row {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 16px;
	margin-bottom: 24px;
}

.form-row > label:first-child {
	flex: 0 0 88px;
	width: 88px;
	margin: 0;
	text-align: right;
}

.form-row input,
.form-row select,
.form-row textarea {
	width: 400px;
	max-width: 520px;
	margin: 0;
}

.form-row input[type="date"] {
	width: 220px;
}

/* 性別選択 */
.gender-group {
	display: flex;
	gap: 24px;
	align-items: center;
}

.gender-group label {
	display: flex;
	gap: 6px;
	align-items: center;
	font-size: 14px;
	font-weight: normal;
}

.gender-group input[type="radio"] {
	width: auto;
	height: auto;
	margin: 0;
}

/* ==============================
   表
============================== */

table {
	width: 100%;
	border-collapse: collapse;
	background: #ffffff;
	border-radius: var(--radius-card);
	overflow: hidden;
	box-shadow: 0 6px 18px rgba(80, 120, 150, 0.1);
}

th,
td {
	padding: 14px;
	border-bottom: 1px solid #e5f3fb;
	text-align: left;
}

th {
	background: #eaf7ff;
	color: #25637a;
}

.center {
	text-align: center;
}

/* ==============================
   パンくず
============================== */

.breadcrumb {
	margin: 8px 0 16px;
	font-size: 14px;
	color: #64748b;
}

.breadcrumb a {
	color: #4aa3d8;
	text-decoration: none;
}

.breadcrumb a:hover {
	text-decoration: underline;
}

/* プリント登録PDFプレビュー */
.pdf-preview-area {
	width: min(100%, 760px);
	margin: 4px auto 24px;
	padding: 18px;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow-card);
}

.pdf-preview-title {
	margin-bottom: 14px;
	font-size: 18px;
	text-align: left;
}

.pdf-preview-frame {
	display: block;
	width: 100%;
	height: min(70vh, 720px);
	min-height: 480px;
	border: 1px solid var(--color-control-border);
	border-radius: var(--radius-control);
	background: #f8fafc;
}

.pdf-preview-message {
	margin: 0;
	padding: 24px;
	color: var(--color-muted);
	text-align: center;
}

/* ==============================
   レベル・チャート
============================== */

.chart-box {
	width: 100%;
	max-width: 500px;
	margin: 24px auto;
}

.level-links {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin-top: 20px;
}

.level-links a {
	text-decoration: none;
	text-align: center;
	padding: 12px;
	border-radius: var(--radius-control);
	background: #eef9ff;
	color: #25637a;
	font-weight: bold;
}

.level-control {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.level-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
}

.level-name {
	width: 80px;
	text-align: right;
}

.level-value {
	width: 45px;
	text-align: center;
	font-weight: bold;
}

/* ==============================
   プリントカード
============================== */

.print-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 24px;
	margin-top: 24px;
}

.print-card {
	position: relative;
	display: block;

	background: var(--color-surface);
	border-radius: var(--radius-card);
	padding: 16px;

	box-shadow: var(--shadow-card);
	border: 1px solid var(--color-border);

	text-align: center;
	text-decoration: none;
	color: inherit;

	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.print-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--shadow-hover);
}

.print-thumbnail {
	width: 100%;
	height: 160px;
	object-fit: contain;

	background: #f8fbfd;
	border-radius: var(--radius-control);

	display: flex;
	align-items: center;
	justify-content: center;

	font-size: 28px;
	font-weight: bold;
	color: #94a3b8;

	margin-bottom: 12px;
}

.print-title {
	font-weight: bold;
	color: #334155;
	word-break: break-all;
}

.print-info {
	text-align: center;
	font-size: 14px;
	color: #64748b;
	margin-top: 6px;
}

.print-subject-title {
	font-size: 20px;
	font-weight: bold;
	cursor: pointer;
	padding: 12px 14px;
	color: #25637a;
}

/* ==============================
   プリント選択・カート
============================== */

.selectable-print-card {
	cursor: pointer;
	position: relative;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.print-check {
	display: none;
}

.selectable-print-card.selected {
	outline: 4px solid #8fd6b3;
	background: #f0fff7;
	transform: scale(1.02);
}

/* カード右上の登録済み・印刷済み回数 */
.print-count-icons {
	position: absolute;
	top: 8px;
	right: 8px;
	display: flex;
	align-items: center;
	gap: 6px;
	z-index: 2;
}

/* アイコンと回数の共通デザイン */
.print-count-icon {
	min-width: 34px;
	height: 30px;
	padding: 0 7px;
	box-sizing: border-box;
	border: 1px solid #25637a;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 3px;
	font-size: 13px;
	font-weight: bold;
	line-height: 1;
}

/* バッジ内のアイコン */
.print-count-icon svg {
	width: 15px;
	height: 15px;
	fill: currentColor;
	flex-shrink: 0;
}

/* 登録済み回数・印刷済み回数は同じ配色 */
.registered-count-icon,
.printed-count-icon {
	background: #ffffff;
	color: #25637a;
}

/* ==============================
   ページ切り替え
============================== */

.pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 28px;
	text-align: center;
}

.page-info {
	font-weight: bold;
	color: #64748b;
}

/* ==============================
   その他
============================== */

.button-area {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	flex-wrap: wrap;
	margin-top: 20px;
}

.detail-menu {
	width: fit-content;
	margin-left: auto;
	text-align: right;
}

/* カート操作エリア */
.cart-action-area {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 12px;
	margin-bottom: 24px;
}

/* 自動並び替えボタンと表裏設定 */
.auto-sort-panel {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.duplex-sort-settings {
	width: auto;
	margin-top: 6px;
	padding: 0;
	border: 1px solid var(--color-control-border);
	border-radius: var(--radius-control);
	background: #f8fcff;
	box-sizing: border-box;
}

.duplex-sort-settings[open] {
	width: min(460px, 86vw);
	padding: 10px 14px;
}

.duplex-sort-settings summary {
	cursor: pointer;
	color: #25637a;
	font-weight: bold;
	text-align: center;
	padding: 5px 11px;
	font-size: 13px;
	line-height: 1.4;
}

.duplex-sort-settings[open] summary {
	padding: 0;
}

.duplex-mode-note {
	margin: 12px 0;
	color: #64748b;
	font-size: 13px;
	text-align: center;
}

.duplex-side-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
}

.duplex-side-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin: 0;
}

.duplex-side-row select {
	width: 86px;
	margin: 0;
	padding: 7px 9px;
	border-radius: var(--radius-control);
	font-size: 14px;
}

/* 児童ごとのカート枠 */
.student-cart-box {
	margin-top: 24px;
}

/* プリントカード全体リンク */
.print-card-link {
	display: block;
	color: inherit;
	text-decoration: none;
}

/* 空メッセージ */
.empty-message {
	padding: 14px 16px;
	border-radius: var(--radius-control);
	background: #f8fbfd;
	color: var(--color-muted);
	font-size: 14px;
	margin: 16px 0;
}

/* レベル変更ボタン */
.level-btn {
	width: 34px;
	height: 34px;

	border: 1px solid #d1d5db;
	border-radius: 50%;

	background: #ffffff;
	color: #111827;

	font-size: 18px;
	font-weight: bold;

	cursor: pointer;
}

/* レベル変更ボタン hover */
.level-btn:hover {
	background: #f3f4f6;
}

/* エラーメッセージ */
.error-message {
	min-height: 0;
	color: #dc2626;
	font-weight: 600;
	text-align: center;
	margin-bottom: 18px;
}

/* 未処理画像 */
.pending-image {
	width: 120px;
	height: auto;
	border-radius: 8px;
	display: block;
}

/* 児童ヘッダー */
.student-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 24px;
}

/* 児童名 */
.student-header .student-name {
	font-size: 30px;
	font-weight: bold;
	color: #334155;
}

/* 児童データ画面へ移動する児童名リンク */
.student-name-link {
	color: inherit;
	text-decoration: none;
}

.student-name-link:hover {
	text-decoration: underline;
}

/* 学習履歴リンク */
.study-history-link {
	text-decoration: none;
	font-weight: bold;
	color: #3b82f6;
	transition: 0.2s;
}

.study-history-link:hover {
	color: #2563eb;
}

/* ==============================
   学習履歴
============================== */

.study-history-card {
	padding: clamp(20px, 3vw, 32px);
}

.study-history-heading {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--color-border);
}

.study-history-heading h1 {
	margin: 0;
	font-size: clamp(24px, 3vw, 32px);
	text-align: left;
}

.study-history-eyebrow {
	margin: 0 0 3px;
	color: var(--color-muted);
	font-size: 13px;
	font-weight: bold;
}

.study-history-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 58px;
	height: 38px;
	padding: 0 12px;
	border: 1px solid var(--color-control-border);
	border-radius: 10px;
	background: #f4fbff;
	color: var(--color-primary);
	font-size: 14px;
	font-weight: bold;
}

.study-history-controls {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin: 18px 0;
}

.study-history-control-label {
	margin-right: 2px;
	color: var(--color-muted);
	font-size: 12px;
	font-weight: bold;
}

.study-history-date-sort {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	min-height: 36px;
	padding: 7px 12px;
	border: 1px solid var(--color-control-border);
	border-radius: 9px;
	background: #ffffff;
	color: var(--color-muted);
	font-size: 13px;
	font-weight: bold;
	text-decoration: none;
}

.study-history-date-sort:hover {
	border-color: var(--color-primary);
	color: var(--color-primary);
}

.study-history-date-sort.active {
	border-color: var(--color-primary);
	background: #f4fbff;
	color: var(--color-primary);
}

.study-history-subject-filter {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin: 0 0 0 auto;
	color: var(--color-muted);
	font-size: 12px;
}

.study-history-subject-filter select {
	width: auto;
	min-width: 120px;
	min-height: 36px;
	margin: 0;
	padding: 6px 30px 6px 10px;
	border-radius: 9px;
	font-size: 13px;
}

.study-history-filter-status {
	color: var(--color-primary);
	font-size: 12px;
	font-weight: bold;
}

.study-history-list {
	display: grid;
	gap: 12px;
}

.study-record-item {
	display: grid;
	grid-template-columns: 150px minmax(0, 1fr) auto;
	align-items: center;
	gap: 20px;
	padding: 18px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-control);
	background: #fbfdff;
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.study-record-item:hover {
	border-color: #b9dbea;
	box-shadow: 0 6px 16px rgba(80, 120, 150, 0.1);
}

.study-record-item[hidden] {
	display: none;
}

.study-record-date {
	color: var(--color-primary);
	font-size: 14px;
	font-weight: bold;
}

.study-record-content {
	min-width: 0;
}

.study-record-subject {
	display: inline-flex;
	align-items: center;
	min-height: 26px;
	padding: 3px 9px;
	border-radius: 8px;
	background: #eaf7ff;
	color: var(--color-primary);
	font-size: 12px;
	font-weight: bold;
}

.study-record-title {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-top: 7px;
	color: var(--color-text);
	font-size: 17px;
	font-weight: bold;
	line-height: 1.45;
	text-decoration: none;
}

.study-record-title:hover {
	color: var(--color-primary);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.study-record-title span {
	flex: 0 0 auto;
	color: var(--color-muted);
	font-size: 11px;
	font-weight: normal;
}

.study-record-memo {
	margin: 9px 0 0;
	color: var(--color-muted);
	font-size: 13px;
	line-height: 1.55;
}

.study-record-memo span {
	margin-right: 7px;
	font-weight: bold;
}

.study-record-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.study-record-actions form {
	margin: 0;
}

.study-record-action,
.study-record-delete {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 58px;
	min-height: 38px;
	padding: 7px 11px;
	border-radius: 9px;
	font-size: 12px;
	font-weight: bold;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
}

.study-record-action {
	border: 1px solid var(--color-primary);
	background: #f4fbff;
	color: var(--color-primary);
}

.study-record-action:hover {
	background: #eaf7ff;
}

.study-record-delete {
	border: 1px solid #d97777;
	background: #fff7f7;
	color: #b94b4b;
}

.study-record-delete:hover {
	background: #ffeaea;
}

.study-record-no-image {
	color: #94a3b8;
	font-size: 11px;
	white-space: nowrap;
}

.study-history-empty {
	padding: 48px 20px;
	text-align: center;
}

.study-history-empty p {
	margin: 0 0 6px;
	color: var(--color-text);
	font-weight: bold;
}

.study-history-empty span {
	color: var(--color-muted);
	font-size: 13px;
}

/* メモ枠 */
.student-memo {
	margin-bottom: 28px;
}

/* メモタイトル */
.student-memo-title {
	font-size: 14px;
	font-weight: bold;
	color: #64748b;
	margin-bottom: 8px;
}

/* メモ本文 */
.student-memo-body {
	background: #f8fbfb;
	border: 1px solid #e5eef5;
	border-radius: var(--radius-control);
	padding: 20px;
	white-space: pre-line;   /* 改行だけ保持 */
}

/* まとめPDFカード */
.print-job-card {
	border: 2px dashed #c9c9c9;
	background-color: #fafafa;
}

/* まとめPDF風サムネイル */
.print-job-thumbnail {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background-color: #f2f2f2;
	border: 1px solid #d0d0d0;
	color: #555;
}

/* PDFアイコン文字 */
.pdf-icon {
	font-size: 28px;
	font-weight: bold;
	letter-spacing: 1px;
}

/* まとめPDFラベル */
.pdf-label {
	margin-top: 6px;
	font-size: 13px;
}

/* 作成済みPDFエリアの見出し */
.student-cart-box h3 {
	margin-top: 24px;
	margin-bottom: 12px;
}

/* ログインカード */
.login-card {
	max-width: 420px;
	margin: 80px auto 0;
}

/* ログインフォーム */
.login-form {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.login-form label {
	margin-top: 6px;
	margin-bottom: 0;
	font-weight: bold;
}

.login-form input {
	margin-bottom: 4px;
}

/* ログイン画面だけ背景の境目を消す */
body.login-page {
	min-height: 100vh;
}

.progress-box {
	margin: 14px auto 20px;
	max-width: 520px;
}

.progress-text {
	text-align: center;
	font-weight: bold;
	margin-bottom: 8px;
}

.progress-bar {
	height: 16px;
	background: #e5e7eb;
	border-radius: 999px;
	overflow: hidden;
}

.progress-fill {
	height: 100%;
	background: #38bdf8;
	border-radius: 999px;
}

/* 未処理登録の候補プリントモーダル */
.candidate-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 1000;
	background: rgba(15, 23, 42, 0.45);
}

.candidate-modal.active {
	display: flex;
	align-items: center;
	justify-content: center;
}

.candidate-modal-content {
	width: min(720px, 92vw);
	max-height: 82vh;
	overflow-y: auto;
	background: #ffffff;
	border-radius: var(--radius-card);
	padding: 22px;
	box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.candidate-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 14px;
}

.candidate-modal-header h3 {
	margin: 0;
}

.candidate-modal-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid var(--color-control-border);
	border-radius: 50%;
	background: var(--color-surface);
	color: var(--color-text);
	font-size: 24px;
	font-weight: bold;
	cursor: pointer;
}

.candidate-print-area {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 12px;
}

.candidate-print-card {
	width: 110px;
	padding: 8px;
	cursor: pointer;
}

.candidate-print-area .print-thumbnail {
	width: 100%;
	height: 78px;
	object-fit: contain;
}

.candidate-print-area .print-title {
	margin-top: 6px;
	font-size: 12px;
	line-height: 1.3;
}

.candidate-print-area .print-info {
	font-size: 11px;
}

.selected-print-name {
	margin: 8px 0;
	font-weight: bold;
	color: #334155;
}

/* サイドバーを置けない幅では、画面下のコンパクト表示へ切り替える */
@media screen and (max-width: 1100px) {
	body.cart-sidebar-visible {
		padding-right: 0;
		padding-bottom: 78px;
	}

	.cart-sidebar {
		display: none;
	}

	.cart-sidebar-mobile-bar {
		position: fixed;
		left: 16px;
		right: 16px;
		bottom: 12px;
		z-index: 850;
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: 52px;
		padding: 10px 16px;
		color: #ffffff;
		background: var(--color-primary);
		border-radius: 14px;
		box-shadow: 0 10px 28px rgba(15, 23, 42, 0.24);
	}
}

/* スマホ・狭い画面対応 */
@media screen and (max-width: 700px) {
	:root {
		--header-height: 64px;
	}

	.header {
		height: var(--header-height);
		padding: 0 18px;
		flex-direction: row;
		align-items: center;
		gap: 10px;
	}

	.header-cart {
		width: 44px;
		justify-content: center;
	}

	.header-right {
		margin-left: auto;
		gap: 8px;
	}

	.page-heading {
		width: 92%;
		font-size: 24px;
		margin-top: 20px;
	}

	.container {
		width: 92%;
		padding-top: 20px;
	}

	.home-menu {
		flex-direction: column;
	}

	.student-list-tools {
		padding: 0;
	}

	.student-tools-row {
		align-items: center;
	}

	.student-sort-menu summary {
		min-height: 46px;
		padding: 0 13px;
	}

	.student-sort-popover {
		grid-template-columns: 1fr;
		gap: 10px;
		width: calc(100vw - 32px);
		padding: 14px;
	}

	.student-sort-popover .student-filter-reset {
		grid-column: 1;
		justify-self: stretch;
	}

	.student-filter-status {
		text-align: left;
	}

	.btn,
	.student-register-btn,
	.page-btn,
	.open-candidate-modal {
		width: 100%;
		margin: 4px 0;
	}

	.form-row {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
	}

	.form-row > label:first-child {
		width: auto;
		flex-basis: auto;
		text-align: left;
	}

	.form-row input,
	.form-row select,
	.form-row textarea {
		width: 100%;
	}

	.form-row input[type="date"] {
		width: 100%;
	}

	.gender-group {
		flex-wrap: wrap;
		gap: 12px;
	}

	.level-links {
		grid-template-columns: 1fr;
	}

	.button-area {
		gap: 10px;
	}

	.pdf-preview-area {
		padding: 12px;
	}

	.pdf-preview-frame {
		height: 58vh;
		min-height: 380px;
	}

	.student-header {
		align-items: flex-start;
		flex-direction: column;
		gap: 10px;
	}

	.study-history-card {
		padding: 18px 14px;
	}

	.study-record-item {
		grid-template-columns: 1fr;
		gap: 10px;
		padding: 15px;
	}

	.study-history-controls {
		align-items: flex-end;
	}

	.study-history-subject-filter {
		align-items: flex-start;
		flex-direction: column;
		margin-left: 0;
		gap: 3px;
	}

	.study-record-date {
		padding-bottom: 8px;
		border-bottom: 1px solid var(--color-border);
	}

	.study-record-title {
		align-items: flex-start;
		flex-direction: column;
		gap: 3px;
	}

	.study-record-actions {
		justify-content: flex-end;
		padding-top: 4px;
	}
}
