/* ===== 共通 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Yu Gothic", "YuGothic", "Hiragino Sans", "Meiryo", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

/* ===== フォーム画面 ===== */
.form-page {
    background: linear-gradient(135deg, #e8f0fe 0%, #f5f5f5 100%);
    padding: 2rem;
    min-height: 100vh;
}

.form-container {
    max-width: 700px;
    margin: 0 auto;
    background: #fff;
    padding: 0 2rem 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.form-header {
    background: linear-gradient(135deg, #1a5276 0%, #2c3e50 100%);
    color: #fff;
    margin: 0 -2rem 0;
    padding: 1.25rem 2rem;
    text-align: center;
}

.form-container .form-header h1 {
    font-size: 1.4rem;
    letter-spacing: 0.1em;
    margin: 0;
    color: #fff;
}

.form-header .subtitle {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

fieldset {
    border: none;
    border-left: 4px solid #2980b9;
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    background: #f8fafc;
}

legend {
    font-weight: bold;
    font-size: 0.95rem;
    color: #fff;
    padding: 0.3rem 1rem;
    background: #2980b9;
    border-radius: 4px;
    margin-left: -0.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 120px;
}

.form-group.wide {
    flex: 2;
    min-width: 300px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.15);
}

.date-section-label {
    display: block;
    font-size: 0.9rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.25rem;
    margin-top: 0.5rem;
    padding-left: 0.2rem;
}

.date-section-label:first-child {
    margin-top: 0;
}

.form-hint {
    font-size: 0.78rem;
    color: #888;
    margin: -0.25rem 0 0.75rem 0.2rem;
}

.form-actions {
    text-align: center;
    margin-top: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #2980b9 0%, #1a5276 100%);
    color: #fff;
    border: none;
    padding: 0.85rem 2.5rem;
    font-size: 1.05rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    letter-spacing: 0.05em;
    transition: opacity 0.2s, transform 0.1s;
    box-shadow: 0 2px 8px rgba(41, 128, 185, 0.3);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(41, 128, 185, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-block;
    background: #95a5a6;
    color: #fff;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    margin-left: 1rem;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

/* ===== フォームナビゲーションタブ ===== */
.form-nav {
    display: flex;
    margin: 0 -2rem 0;
    background: #eaecee;
    border-bottom: 3px solid #2980b9;
}

.form-nav-tab {
    flex: 1;
    text-align: center;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: #7f8c8d;
    font-weight: bold;
    font-size: 0.95rem;
    background: #eaecee;
    border: none;
    position: relative;
    transition: background 0.2s, color 0.2s;
}

.form-nav-tab:hover {
    background: #d5dbdb;
    color: #2c3e50;
}

.form-nav-tab.active {
    background: #2980b9;
    color: #fff;
    border-bottom: 3px solid #fff;
    margin-bottom: -3px;
}

/* ===== 継続前/継続後フィールドセットの色分け ===== */
.fieldset-before {
    border-left-color: #5d6d7e;
    background: #f4f6f7;
}

.fieldset-before legend {
    background: #5d6d7e;
}

.fieldset-after {
    border-left-color: #d35400;
    background: #fdf2e9;
}

.fieldset-after legend {
    background: #d35400;
}

.fieldset-after .form-group input:focus,
.fieldset-after .form-group select:focus {
    border-color: #d35400;
    box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.15);
}

.section-divider {
    text-align: center;
    margin: 0.5rem 0 1rem;
    font-size: 1.3rem;
    color: #95a5a6;
    letter-spacing: 0.3em;
}

/* ===== 継続契約書固有スタイル ===== */
.keizoku-note-red {
    color: #cc0000;
    font-weight: bold;
    font-size: 8pt;
}

.nochange-check {
    display: inline-block;
    font-size: 8.5pt;
    font-weight: bold;
    border: 1px solid #999;
    padding: 0 3mm;
    background: #fafafa;
}

/* 継続契約書プレビュー：テーブルヘッダ色分け */
.tuition-header-before {
    background: #d5d8dc !important;
    color: #2c3e50 !important;
}

.tuition-header-after {
    background: #fae5d3 !important;
    color: #2c3e50 !important;
}

/* ===== 契約書画面 ===== */
.contract-page {
    background: #e0e0e0;
}

.action-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #2c3e50;
    padding: 0.75rem 2rem;
    z-index: 100;
    text-align: center;
}

/* --- A3用紙プレビュー (297mm x 420mm) --- */
.contract-sheet {
    width: 297mm;
    height: 420mm;
    margin: 60px auto 20px;
    padding: 10mm 14mm;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-size: 10.5pt;
    overflow: hidden;
    position: relative;
}

.sheet-inner {
    width: 100%;
    height: 100%;
    transform-origin: top left;
}

.contract-sheet + .contract-sheet {
    margin-top: 20px;
}

/* ヘッダ */
.contract-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1mm;
}

.header-notice {
    font-size: 9pt;
}

/* 特定商取引法施行規則第6条第2項：書面をよく読むべき旨 → 赤枠・赤字 */
.red-box {
    color: #cc0000;
    border: 2px solid #cc0000;
    padding: 0.1rem 0.3rem;
    font-weight: bold;
    display: inline-block;
}

.header-info {
    border-collapse: collapse;
    font-size: 10pt;
}

.header-info th {
    text-align: left;
    padding: 0.1rem 0.3rem;
    font-weight: normal;
    white-space: nowrap;
}

.header-info td {
    padding: 0.1rem 0.3rem;
    border-bottom: 1px solid #999;
    min-width: 60px;
}

.header-row2 {
    display: flex;
    justify-content: space-between;
    font-size: 10pt;
    margin-bottom: 1mm;
}

/* タイトル */
.contract-title {
    text-align: center;
    font-size: 16pt;
    margin: 1mm 0;
    letter-spacing: 0.3em;
}

/* 前文 */
.preamble {
    font-size: 9pt;
    margin-bottom: 1mm;
    line-height: 1.4;
}

/* 契約期間 */
.contract-period {
    margin-bottom: 1mm;
    font-size: 10pt;
}

.period-sub {
    font-size: 9pt;
    color: #555;
}

/* 契約期間テーブル（エクセル準拠） */
.period-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1mm;
    font-size: 10pt;
}
.period-table th,
.period-table td {
    border: 1px solid #000;
    padding: 1mm 3mm;
    text-align: center;
}
.period-table th {
    background-color: #f0f0f0;
    font-weight: bold;
    width: 15%;
}
.period-table .period-separator {
    width: 5%;
    border-left: none;
    border-right: none;
}

/* セクションタイトル */
.section-title {
    font-size: 10pt;
    margin: 1.5mm 0 1mm;
}

/* 情報テーブル（手書き欄） */
.info-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9.5pt;
    margin-bottom: 1.5mm;
}

.info-table th,
.info-table td {
    border: 1px solid #333;
    padding: 1mm 1.5mm;
    vertical-align: top;
}

.info-table th {
    background: #f0f0f0;
    font-weight: bold;
    white-space: nowrap;
    width: 11%;
    font-size: 8.5pt;
}

.info-table td {
    width: 39%;
}

.info-table .handwrite {
    min-height: 5mm;
    background: #fff;
}

.th-sub {
    font-weight: normal;
    font-size: 7.5pt;
}

/* 注記 */
.note-small {
    font-size: 7.5pt;
    color: #555;
    margin-bottom: 1mm;
}

/* 月謝テーブル */
.tuition-columns {
    display: flex;
    gap: 3mm;
    margin-bottom: 1.5mm;
}

.tuition-col {
    flex: 1;
}

.tuition-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8.5pt;
}

.tuition-table th,
.tuition-table td {
    border: 1px solid #333;
    padding: 0.5mm 1mm;
}

/* データ行・空行とも手書きできる高さを確保 */
.tuition-table tbody td {
    height: 15mm;
}

.tuition-table thead th,
.tuition-table th {
    background: #f0f0f0;
    font-weight: bold;
    text-align: center;
    font-size: 8pt;
}

.tuition-header {
    background: #e0e0e0 !important;
    font-size: 9.5pt !important;
    text-align: center;
}
.tuition-left-header {
    background: #f5f5f5;
    font-size: 8pt;
    text-align: center;
    vertical-align: middle;
    width: 12mm;
    padding: 2mm 1mm;
}

.tuition-period td {
    text-align: center;
    font-size: 8pt;
    background: #fafafa;
}

.tuition-table .num {
    text-align: right;
    white-space: nowrap;
}

.tuition-table .note-in-cell {
    font-size: 7pt;
    white-space: nowrap;
}

.tuition-table .discount-row td {
    color: #cc0000;
}

.tuition-table .subtotal-row td {
    background: #fafafa;
    font-weight: bold;
}

.tuition-table .total-row td {
    background: #e8e8e8;
}

/* 振り込み */
.payment-columns {
    display: flex;
    gap: 3mm;
    margin-bottom: 1.5mm;
}

.payment-col {
    flex: 1;
}

.payment-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
    margin-bottom: 1mm;
}

.payment-table th,
.payment-table td {
    border: 1px solid #333;
    padding: 0.5mm 1.5mm;
}

.payment-table th {
    background: #f0f0f0;
    font-weight: bold;
    text-align: left;
    white-space: nowrap;
}

.payment-table .num {
    text-align: right;
    white-space: nowrap;
}

.payment-table .total-row th,
.payment-table .total-row td {
    background: #e8e8e8;
}

.payment-table .handwrite-sm {
    font-size: 8pt;
    min-width: 100px;
}

.payment-table .handwrite-deadline {
    font-size: 8.5pt;
    text-align: center;
    vertical-align: middle;
    min-width: 110px;
    background: #fff;
}

/* 銀行テーブル */
.bank-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8.5pt;
    margin-bottom: 0.5mm;
}

.bank-table th,
.bank-table td {
    border: 1px solid #333;
    padding: 0.5mm 1mm;
}

.bank-table th {
    background: #f0f0f0;
    font-weight: bold;
    white-space: nowrap;
}

/* 特記事項 — 溢れ防止 */
.notes-box {
    border: 1px solid #333;
    padding: 1mm 2mm;
    min-height: 10mm;
    max-height: 18mm;
    font-size: 9pt;
    margin-bottom: 1.5mm;
    white-space: pre-wrap;
    overflow: hidden;
}

/* 確認テーブル */
.confirm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8.5pt;
    margin-bottom: 1.5mm;
}

.confirm-table th,
.confirm-table td {
    border: 1px solid #333;
    padding: 0.5mm 1.5mm;
    vertical-align: top;
}

.confirm-table th {
    background: #f0f0f0;
    font-weight: bold;
    width: 8%;
    text-align: center;
}

.checkbox-line {
    display: inline-block;
    margin-top: 0.5mm;
}

/* 署名テーブル */
.signature-section {
    margin: 1.5mm 0;
    font-size: 9pt;
}

.signature-section > p {
    margin-bottom: 1mm;
}

.signature-table {
    border-collapse: collapse;
    font-size: 9pt;
}

.signature-table th,
.signature-table td {
    border: 1px solid #333;
    padding: 0.5mm 1.5mm;
}

.signature-table th {
    background: #f0f0f0;
    font-weight: bold;
    white-space: nowrap;
}

.signature-table .handwrite {
    min-width: 180px;
}

.signature-table .seal,
.seal {
    width: 2.2em;
    height: 2.2em;
    text-align: center;
    vertical-align: middle;
    font-size: 8.5pt;
    border: 1px solid #333;
}

/* 会社情報 */
.company-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin: 1.5mm 0;
    font-size: 9pt;
}

.company-info p {
    margin-bottom: 0;
}

.staff-info {
    display: flex;
    align-items: center;
}

/* 法的注記セクション（直接交渉の禁止） */
.legal-section {
    margin: 1.5mm 0;
}

.legal-section > p:first-child {
    font-size: 9pt;
    margin-bottom: 0.5mm;
}

.small-text {
    font-size: 7.5pt;
    line-height: 1.3;
}

.small-text p {
    margin-bottom: 0.5mm;
}

/* 特定商取引法施行規則第6条第3項：クーリング・オフ → 赤枠・赤字・8pt以上 */
.cooling-off-section {
    margin: 1.5mm 0;
    border: 2px solid #cc0000;
    padding: 1.5mm 2mm;
    color: #cc0000;
}

.cooling-off-title {
    font-size: 9.5pt;
    font-weight: bold;
    margin-bottom: 0.5mm;
    color: #cc0000;
}

.cooling-off-body {
    font-size: 8pt;
    line-height: 1.3;
    color: #cc0000;
}

.cooling-off-body p {
    margin-bottom: 0.5mm;
}

/* ===== 裏面（約款） ===== */
.page-back .contract-title {
    margin-bottom: 2mm;
}

.terms-columns {
    display: flex;
    gap: 5mm;
}

.terms-col {
    flex: 1;
}

.term-article {
    margin-bottom: 1.2mm;
}

.term-article h3 {
    font-size: 8.5pt;
    font-weight: bold;
    margin-bottom: 0.3mm;
}

.term-article p {
    font-size: 7.5pt;
    line-height: 1.3;
    margin-bottom: 0.5mm;
}

.term-article .note-small {
    font-size: 7pt;
}

/* ===== 保存ボタン ===== */
.btn-save {
    background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%);
    color: #fff;
    border: none;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    margin-right: 0.5rem;
}

.btn-save:hover {
    opacity: 0.9;
}

.btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.save-status {
    font-size: 0.9rem;
    margin-left: 1rem;
}

.save-ok {
    color: #2ecc71;
}

.save-error {
    color: #e74c3c;
}

/* ===== 検索ボタン ===== */
.btn-search {
    background: linear-gradient(135deg, #8e44ad 0%, #6c3483 100%);
    color: #fff;
    border: none;
    padding: 0.5rem 1.5rem;
    font-size: 0.95rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    margin-top: 1.4rem;
}

.btn-search:hover {
    opacity: 0.9;
}

.btn-search:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.search-status {
    display: block;
    font-size: 0.85rem;
    min-height: 1.2em;
    margin-bottom: 0.5rem;
    padding-left: 0.2rem;
}

.search-ok {
    color: #27ae60;
    font-weight: bold;
}

.search-error {
    color: #e74c3c;
    font-weight: bold;
}

/* ===== 請求一覧ページ ===== */
.billing-container {
    max-width: 900px;
}

.billing-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.billing-selector label {
    font-weight: bold;
    font-size: 0.9rem;
    color: #555;
}

.billing-selector input,
.billing-selector select {
    padding: 0.5rem 0.65rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    width: auto;
}

.btn-sm {
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
}

.billing-title {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    border-bottom: 2px solid #2980b9;
    padding-bottom: 0.5rem;
}

.billing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.billing-table th,
.billing-table td {
    border: 1px solid #ddd;
    padding: 0.6rem 0.8rem;
    text-align: left;
}

.billing-table thead th {
    background: #2980b9;
    color: #fff;
    font-weight: bold;
}

.billing-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.billing-table tbody tr:hover {
    background: #eaf2f8;
}

.billing-table .num {
    text-align: right;
    white-space: nowrap;
}

.billing-total-row td {
    background: #eaecee;
    border-top: 2px solid #2980b9;
}

.billing-error {
    background: #fdecea;
    color: #c0392b;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.billing-empty {
    text-align: center;
    color: #888;
    padding: 2rem;
    font-size: 1rem;
}

/* ===== ダッシュボード ===== */
.dashboard-container {
    max-width: 900px;
}

.kpi-cards {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.kpi-card {
    flex: 1;
    min-width: 140px;
    background: linear-gradient(135deg, #f8fafc 0%, #eaf2f8 100%);
    border: 1px solid #d4e6f1;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    text-align: center;
}

.kpi-label {
    font-size: 0.8rem;
    color: #7f8c8d;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #1a5276;
    line-height: 1.2;
}

.kpi-unit {
    font-size: 0.9rem;
    font-weight: normal;
    color: #555;
    margin-left: 0.15rem;
}

.kpi-sub {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.2rem;
}

.dash-section-title {
    font-size: 1.05rem;
    color: #2c3e50;
    margin: 1.5rem 0 0.75rem;
    border-bottom: 2px solid #2980b9;
    padding-bottom: 0.4rem;
}

/* バーチャート */
.chart-container {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-row-current {
    font-weight: bold;
}

.chart-label {
    width: 60px;
    font-size: 0.8rem;
    color: #555;
    text-align: right;
    flex-shrink: 0;
}

.chart-bar-wrap {
    flex: 1;
    background: #f0f3f5;
    border-radius: 3px;
    height: 22px;
    overflow: hidden;
}

.chart-bar {
    height: 100%;
    border-radius: 3px;
    min-width: 2px;
    transition: width 0.3s;
}

.bar-past {
    background: #2980b9;
}

.bar-current {
    background: #e67e22;
}

.bar-future {
    background: #aed6f1;
}

.chart-value {
    width: 170px;
    font-size: 0.8rem;
    color: #333;
    text-align: right;
    flex-shrink: 0;
}

.chart-count {
    color: #999;
    font-size: 0.75rem;
}

.chart-legend {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    margin-top: 0.75rem;
    font-size: 0.78rem;
    color: #777;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* ===== フラッシュメッセージ ===== */
.flash-message {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.flash-success {
    background: #d5f5e3;
    color: #1e8449;
    border: 1px solid #a9dfbf;
}

.flash-error {
    background: #fdecea;
    color: #c0392b;
    border: 1px solid #f5b7b1;
}

/* ===== 請求一覧アクションボタン ===== */
.billing-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.billing-actions .btn-sm {
    text-decoration: none;
    display: inline-block;
}

.edit-link {
    color: #2980b9;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: bold;
}

.edit-link:hover {
    text-decoration: underline;
}

/* ===== CSVアップロード ===== */
.upload-form .form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.upload-result {
    background: #f8fafc;
    border: 1px solid #d4e6f1;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.upload-result-summary {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.upload-ok {
    color: #27ae60;
    font-weight: bold;
    margin-right: 1rem;
}

.upload-err {
    color: #e74c3c;
    font-weight: bold;
    margin-right: 1rem;
}

.upload-errors {
    font-size: 0.85rem;
    color: #c0392b;
    margin-top: 0.5rem;
}

.upload-errors ul {
    padding-left: 1.5rem;
    margin-top: 0.25rem;
}

.csv-sample {
    margin-top: 1.5rem;
}

.csv-example {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.8;
    overflow-x: auto;
}

.csv-example code {
    white-space: nowrap;
}

/* ===== 削除ボタン ===== */
.delete-form {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
    border: none;
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
}

.btn-danger:hover {
    opacity: 0.9;
}

/* ===== ログインページ ===== */
.login-container {
    max-width: 400px;
}

.login-form {
    padding: 2rem 0 1rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-back {
    text-align: center;
    margin-top: 1.5rem;
}

.login-back a {
    color: #7f8c8d;
    font-size: 0.85rem;
    text-decoration: none;
}

.login-back a:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* ===== ログアウトバー ===== */
.logout-bar {
    text-align: right;
    padding: 0.5rem 0;
    margin-bottom: 0.75rem;
}

.logout-link {
    font-size: 0.78rem;
    color: #999;
    text-decoration: none;
    padding: 0.25rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: color 0.2s, border-color 0.2s;
}

.logout-link:hover {
    color: #e74c3c;
    border-color: #e74c3c;
}

/* ===== 報告書アプリ登録リンク ===== */
.student-register-link {
    color: #2980b9;
    font-weight: bold;
    text-decoration: underline;
}

.student-register-link:hover {
    color: #1a5276;
}

/* ===== 自動計算ステータス ===== */
.calc-status-wrap {
    display: flex;
    align-items: flex-end;
    padding-bottom: 0.3rem;
}

.calc-status-text {
    font-size: 0.8rem;
    color: #999;
}

/* ===== 必須マーク ===== */
.form-group label .req,
label.req::after {
    content: " *";
    color: #e74c3c;
    font-weight: bold;
}

/* ===== テーブルレスポンシブ ===== */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===== 生徒リンク ===== */
.student-link {
    color: #2980b9;
    text-decoration: none;
    font-weight: bold;
}

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

/* ===== 契約履歴ステータスバッジ ===== */
.status-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
}

.badge-active {
    background: #d5f5e3;
    color: #1e8449;
}

.badge-ended {
    background: #eaecee;
    color: #7f8c8d;
}

.history-past td {
    color: #999;
}

/* ===== 講習フォーム固有スタイル ===== */
.doc-type-toggle {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 0;
}

.doc-type-toggle label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    color: #555;
}

.doc-type-toggle input[type="radio"] {
    width: 1.1em;
    height: 1.1em;
    accent-color: #2980b9;
}

.form-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
}

.form-table th {
    background: #f0f4f8;
    font-size: 0.78rem;
    padding: 0.4rem 0.5rem;
    text-align: center;
    border: 1px solid #cbd5e1;
    font-weight: bold;
    color: #555;
}

.form-table td {
    padding: 0.2rem;
    border: 1px solid #cbd5e1;
}

.form-table input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
}

.form-table input:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 2px rgba(41, 128, 185, 0.15);
}

.form-table .num-input {
    text-align: right;
}

.tuition-sum {
    text-align: right;
    font-weight: bold;
    font-size: 1.05rem;
    padding: 0.5rem 0.5rem;
    color: #1a5276;
}

.calc-display {
    display: inline-block;
    min-width: 80px;
    padding: 0.4rem 0.5rem;
    background: #f0f4f8;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    font-weight: bold;
    color: #1a5276;
    text-align: right;
    font-size: 0.9rem;
}

/* ===== 一括更新ページ ===== */
.renew-container {
    max-width: 1400px;
}

.renew-filter {
    margin: 0;
}

.renew-count {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.75rem;
    font-weight: bold;
}

.renew-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    white-space: nowrap;
}

.renew-table th,
.renew-table td {
    border: 1px solid #ddd;
    padding: 0.4rem 0.5rem;
    text-align: left;
    vertical-align: middle;
}

.renew-table thead th {
    background: #2980b9;
    color: #fff;
    font-weight: bold;
    font-size: 0.8rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

.renew-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.renew-table tbody tr:hover {
    background: #eaf2f8;
}

.renew-arrow-th {
    width: 30px;
    text-align: center;
}

.renew-arrow {
    text-align: center;
    font-weight: bold;
    color: #d35400;
    font-size: 1.1rem;
}

.renew-input {
    padding: 0.25rem 0.35rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
}

select.renew-input {
    min-width: 60px;
}

input.renew-date {
    width: 130px;
}

.renew-action-cell {
    text-align: center;
}

.btn-renew {
    background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%);
    color: #fff;
    border: none;
    padding: 0.35rem 1rem;
    font-size: 0.85rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
}

.btn-renew:hover {
    opacity: 0.9;
}

.btn-renew:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.renew-result {
    display: block;
    font-size: 0.78rem;
    margin-top: 0.25rem;
    min-height: 1em;
}

.renew-done {
    background: #f0f0f0 !important;
    opacity: 0.7;
}

.renew-done td {
    color: #999;
}

.no-wrap {
    white-space: nowrap;
}

/* ===== 印刷用CSS ===== */
@media print {
    body {
        background: #fff;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
    }

    .no-print {
        display: none !important;
    }

    .contract-sheet {
        width: 100%;
        height: auto;
        max-height: 410mm;
        margin: 0;
        padding: 8mm 12mm;
        box-shadow: none;
        page-break-after: always;
        overflow: hidden;
    }

    .contract-sheet:last-child {
        page-break-after: auto;
    }

    @page {
        size: A3 portrait;
        margin: 5mm;
    }
}
