/* === シンプルカルテ管理 - SMRM スタイルシート === */

:root {
    --primary: #92400e;
    --primary-light: #fef3c7;
    --primary-dark: #78350f;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --border-radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* === ヘッダー === */
.app-header {
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.2em;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-left: 30px;
}

/* === 左上固定: ページ先頭へ戻るボタン === */
.scroll-to-top-btn {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 9999;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.7);
    background: rgba(146, 64, 14, 0.85);
    color: white;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s, transform 0.1s;
}

.scroll-to-top-btn:hover {
    background: rgba(146, 64, 14, 1);
}

.scroll-to-top-btn:active {
    transform: translateY(1px);
}

.scroll-to-top-btn:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

.scroll-to-top-icon {
    width: 18px;
    height: 18px;
    display: block;
    pointer-events: none;
}

/* === 右上固定: バージョン情報 === */
.app-info-display {
    position: fixed;
    top: 6px;
    right: 10px;
    z-index: 9999;
    font-size: 0.65em;
    color: rgba(255, 255, 255, 0.7);
    text-align: right;
    line-height: 1.3;
    pointer-events: none;
    white-space: nowrap;
}

/* === 印刷非表示 === */
.no-print {}

/* === 更新バナー === */
.update-banner {
    background: var(--warning-light);
    color: #92400e;
    border-bottom: 1px solid #fbbf24;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 0.85em;
    font-weight: 500;
    position: sticky;
    top: 44px;
    z-index: 99;
}

.update-banner .btn {
    background: #f59e0b;
    color: white;
    padding: 4px 12px;
    font-size: 0.8em;
}

.update-banner .btn:hover {
    background: #d97706;
}

.update-banner-close {
    background: none;
    border: none;
    color: #92400e;
    cursor: pointer;
    font-size: 1.1em;
    padding: 2px 6px;
    opacity: 0.6;
    line-height: 1;
}

.update-banner-close:hover {
    opacity: 1;
}

/* === タブナビゲーション === */
.tab-nav {
    display: flex;
    background: white;
    border-bottom: 2px solid var(--gray-200);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-nav button {
    flex: 1;
    min-width: 80px;
    padding: 12px 16px;
    border: none;
    background: none;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.tab-nav button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-nav button:hover:not(.active) {
    color: var(--gray-700);
    background: var(--gray-50);
}

/* === タブコンテンツ === */
.tab-content {
    display: none;
    padding: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.tab-content.active {
    display: block;
}

/* === カード === */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}

.card h3 {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.card h4 {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.card hr {
    border: none;
    border-top: 1px solid var(--gray-200);
    margin: 16px 0;
}

/* === フォーム === */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1em;
    color: var(--gray-800);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(146, 64, 14, 0.15);
}

.form-group input[type="number"] {
    -moz-appearance: textfield;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.form-section h4 {
    margin-bottom: 12px;
}

/* === ボタン === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    gap: 6px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    background: var(--gray-300);
    color: var(--gray-500);
    cursor: not-allowed;
    transform: none;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85em;
}

.btn-block {
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* === 検索バー === */
.search-bar {
    margin-bottom: 16px;
}

.search-bar input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1em;
    color: var(--gray-800);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(146, 64, 14, 0.15);
}

/* === 顧客一覧 === */
.customer-list {
    margin-bottom: 16px;
}

.customer-card {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    gap: 12px;
    flex-wrap: wrap;
}

.customer-card:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.customer-card.selected {
    background: var(--primary-light);
    border-color: var(--primary);
    border-width: 2px;
}

.customer-card .customer-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

.customer-card .customer-code {
    font-size: 0.8em;
    color: var(--gray-500);
    font-weight: 600;
    min-width: 60px;
}

.customer-card .customer-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.customer-card .customer-name {
    font-weight: 600;
    color: var(--gray-800);
}

.customer-card .customer-meta {
    font-size: 0.85em;
    color: var(--gray-600);
    white-space: nowrap;
}

.customer-card .customer-card-actions {
    display: flex;
    gap: 4px;
}

.customer-card-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--gray-200);
}

.customer-card-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9em;
}

/* === 顧客情報バー === */
.customer-info-bar {
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: var(--border-radius);
    padding: 10px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9em;
    color: var(--primary-dark);
    font-weight: 500;
    cursor: pointer;
}
.customer-info-bar:hover {
    background: #fde68a;
}

.customer-info-bar .customer-bar-code {
    font-weight: 700;
    font-size: 0.85em;
    opacity: 0.7;
}

.customer-info-bar .customer-bar-name {
    font-weight: 700;
}

.customer-info-bar .customer-bar-meta {
    font-size: 0.85em;
    opacity: 0.8;
}

.customer-info-bar .media-inline-thumbs {
    margin-left: auto;
    margin-top: 0;
    gap: 4px;
}

.customer-info-bar .media-inline-thumbs img {
    width: 36px;
    height: 36px;
}

/* === アレルギー警告 === */
.allergy-warning {
    background: var(--danger-light);
    border: 1px solid #fca5a5;
    border-radius: var(--border-radius);
    padding: 10px 16px;
    margin-bottom: 16px;
    color: var(--danger);
    font-size: 0.9em;
    font-weight: 500;
    line-height: 1.5;
}

/* === 施術記録フォーム === */
.treatment-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.treatment-field {
    margin-bottom: 0;
}

.treatment-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1em;
    color: var(--gray-800);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: vertical;
}

.treatment-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(146, 64, 14, 0.15);
}

.treatment-label {
    display: inline-block;
    font-size: 0.85em;
    font-weight: 700;
    margin-bottom: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    color: white;
}

.treatment-chief {
    background: #b45309;
}

.treatment-findings {
    background: #0d9488;
}

.treatment-content {
    background: #7c3aed;
}

.treatment-after {
    background: #2563eb;
}

/* === 前回施術後メモ参照 === */
.prev-plan-hint {
    margin-top: 12px;
    padding: 10px 14px;
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    font-size: 0.85em;
    color: #1d4ed8;
    line-height: 1.5;
}

/* === 体調レベル === */
.body-condition-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.level-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.level-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 4px;
    background: var(--gray-200);
    outline: none;
    transition: background 0.2s;
}

.level-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.level-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.level-display {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--primary);
    min-width: 24px;
    text-align: center;
}

/* === 部位チェックボックスグリッド === */
.body-areas-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.body-areas-grid label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    cursor: pointer;
    padding: 4px 8px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    transition: background 0.2s, border-color 0.2s;
}

.body-areas-grid label:has(input:checked) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
    font-weight: 600;
}

.body-areas-grid input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
}

/* === 体調タグ === */
.condition-tag {
    display: inline-block;
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    margin-right: 4px;
    margin-bottom: 4px;
}

.condition-pain {
    background: #fee2e2;
    color: #dc2626;
}

.condition-stiffness {
    background: #fef3c7;
    color: #b45309;
}

.condition-fatigue {
    background: #e0e7ff;
    color: #4338ca;
}

.condition-areas {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* === 施術メニューバッジ === */
.menu-badge {
    display: inline-block;
    font-size: 0.75em;
    padding: 2px 10px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    white-space: nowrap;
}

/* === 直近記録 === */
.recent-record-card {
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary);
}

.record-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.record-date {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--gray-500);
}

.record-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.record-condition {
    margin-bottom: 8px;
}

.treatment-summary-item {
    font-size: 0.9em;
    color: var(--gray-700);
    margin-bottom: 4px;
    line-height: 1.4;
}

.treatment-summary-item .treatment-label {
    font-size: 0.75em;
    padding: 1px 6px;
    margin-right: 4px;
}

/* === バッジ === */
.badge {
    display: inline-block;
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: #b45309;
}

/* === タイムライン === */
.timeline-container {
    padding: 8px 0;
}

.timeline-month-group {
    margin-bottom: 20px;
}

.timeline-month-label {
    font-size: 0.9em;
    color: var(--primary);
    font-weight: 700;
    padding: 4px 0;
    margin-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}

.timeline-entry {
    position: relative;
    padding: 12px 16px;
    margin-bottom: 8px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    border-left: 4px solid var(--primary);
}

.timeline-entry:hover {
    background: var(--gray-50);
    border-color: var(--primary);
}

.timeline-entry-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.timeline-entry .timeline-date {
    font-size: 0.8em;
    color: var(--gray-500);
    font-weight: 600;
}

.timeline-entry .timeline-type-label {
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.timeline-entry-body {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--gray-200);
    font-size: 0.9em;
}

.timeline-entry.expanded .timeline-entry-body {
    display: block;
}

.timeline-chief,
.timeline-condition,
.timeline-treatment-content {
    margin-bottom: 4px;
    line-height: 1.4;
    color: var(--gray-700);
}

/* === 履歴コントロール === */
.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.history-controls h3 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* === ページネーション === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding-top: 16px;
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: white;
    color: var(--gray-600);
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:hover:not(.active) {
    background: var(--gray-100);
}

/* === メッセージ === */
.message {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.9em;
    margin-bottom: 12px;
    display: none;
}

.message.show {
    display: block;
}

.message.success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #86efac;
}

.message.error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fca5a5;
}

.message.info {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid #fbbf24;
}

.message.progress {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid #fbbf24;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.15s ease;
    width: 0%;
}

.sample-data-description {
    font-size: 0.9em;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 12px;
}

.sample-data-offline-note {
    font-size: 0.85em;
    color: var(--warning);
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 12px;
}

/* === オーバーレイ（モーダル） === */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px;
}

.overlay.show {
    display: flex;
}

.overlay-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 24px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-md);
    max-height: 90vh;
    overflow-y: auto;
}

.overlay-content-wide {
    max-width: 700px;
}

.overlay-content h3 {
    margin-bottom: 16px;
    font-size: 1.1em;
    color: var(--gray-800);
}

.overlay-content p {
    margin-bottom: 20px;
    color: var(--gray-600);
}

.overlay-content .btn-group {
    justify-content: flex-end;
}

/* === 顧客詳細表示（読み取り専用） === */
.detail-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}
.detail-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}
.detail-section h4 {
    font-size: 0.9em;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}
.detail-dl {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}
.detail-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--gray-100);
}
.detail-row:last-child { border-bottom: none; }
.detail-row dt {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--gray-500);
}
.detail-row dd {
    font-size: 0.95em;
    color: var(--gray-800);
    word-break: break-word;
}
.detail-memo {
    font-size: 0.9em;
    color: var(--gray-700);
    white-space: pre-wrap;
    line-height: 1.6;
    background: var(--gray-50);
    padding: 10px 12px;
    border-radius: 6px;
    margin: 0;
}
.detail-tag-list {
    list-style: none;
    padding: 0;
}
.detail-tag-list li {
    padding: 6px 0;
    font-size: 0.9em;
    border-bottom: 1px solid var(--gray-100);
}
.detail-tag-list li:last-child { border-bottom: none; }
.detail-note {
    color: var(--gray-500);
    font-size: 0.9em;
}
.detail-meta-section {
    display: flex;
    gap: 16px;
    padding-top: 8px;
    border-bottom: none;
}
.detail-meta-text {
    font-size: 0.8em;
    color: var(--gray-400);
}

/* === 設定ボタングループ === */
.settings-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* === 動的行（アレルギー・既往歴） === */
.dynamic-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.dynamic-row input,
.dynamic-row select {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.9em;
}

/* === 施術メニュー設定行 === */
.menu-settings-row .menu-name-input {
    flex: 3;
}

.menu-settings-row .menu-duration-input {
    flex: 1;
    min-width: 80px;
}

/* === ユーティリティ === */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--gray-400);
}

/* === 空状態 === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
}

.empty-state p {
    font-size: 0.95em;
}

/* === レスポンシブ: タブレット === */
@media (max-width: 768px) {
    .body-condition-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .body-areas-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .overlay-content-wide {
        max-width: 100%;
    }
}

/* === レスポンシブ: モバイル === */
@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1em;
    }

    .tab-content {
        padding: 12px;
    }

    .card {
        padding: 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .body-condition-grid {
        grid-template-columns: 1fr;
    }

    .body-areas-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .customer-card {
        flex-wrap: wrap;
    }

    .customer-card .customer-card-body {
        min-width: 80px;
        flex-wrap: wrap;
    }

    .customer-card .customer-name {
        white-space: nowrap;
        flex-basis: 100%;
    }

    .customer-info-bar {
        flex-wrap: wrap;
        font-size: 0.85em;
    }

    .settings-buttons {
        flex-direction: column;
    }

    .overlay {
        padding: 10px;
    }

    .overlay-content {
        padding: 16px;
        max-height: 95vh;
    }

    .detail-row {
        grid-template-columns: 100px 1fr;
        gap: 4px;
    }

    .detail-meta-section {
        flex-direction: column;
        gap: 4px;
    }
}

/* === 印刷対応 === */
@media print {
    .no-print {
        display: none !important;
    }

    .app-header,
    .tab-nav,
    .btn,
    .record-actions,
    .search-bar,
    .settings-buttons,
    .overlay {
        display: none !important;
    }

    .tab-content {
        display: block !important;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--gray-200);
    }

    body {
        background: white;
    }
}

/* ===== メディア添付 ===== */
.media-attach-area {
    margin-top: 8px;
}
.media-drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
}
.media-drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(146, 64, 14, 0.05);
}
.media-drop-zone p {
    margin: 4px 0;
    color: var(--gray-500);
    font-size: 0.85rem;
}
.media-hint {
    font-size: 0.75rem !important;
    color: var(--gray-400) !important;
}
.media-select-btn {
    cursor: pointer;
    display: inline-block;
    margin: 4px 0;
}
.media-thumb-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.media-thumb-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}
.media-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}
.media-thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}
.media-thumb-remove:hover {
    background: rgba(220,38,38,0.9);
}

.media-inline-thumbs {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.media-inline-thumbs img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--gray-200);
    cursor: pointer;
}

/* ライトボックス */
#media-lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}
#media-lightbox-overlay.show {
    display: flex;
}
.media-lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
}
.media-lightbox-content img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}
.media-lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 24px;
    line-height: 32px;
    text-align: center;
    cursor: pointer;
}
.media-lightbox-close:hover {
    background: rgba(220,38,38,0.9);
}

/* === 表示設定 === */
.field-hidden { display: none !important; }

.display-settings-section h4 {
    margin: 16px 0 8px;
    font-size: 0.95em;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 4px;
}
.display-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
}
.display-settings-grid label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    cursor: pointer;
    padding: 4px 0;
}
.display-settings-grid input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}
@media (max-width: 600px) {
    .display-settings-grid {
        grid-template-columns: 1fr;
    }
}

/* === 画像圧縮設定 === */
.image-settings-description {
    font-size: 0.85em;
    color: var(--gray-500);
    margin-bottom: 12px;
    line-height: 1.5;
}
.image-preset-hint {
    font-size: 0.82em;
    color: var(--gray-500);
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 6px;
    line-height: 1.5;
}
.image-preset-hint span { display: none; }
.image-preset-hint span.active { display: block; }
