﻿/* ========================================
   AIカルテブック テーマ設定
   ここだけ変えれば全体の色が変わる
======================================== */

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: #f7eee9;
}

.karte-app {
  width: 100%;
  max-width: 960px;
  min-height: 100vh;
  margin: 0 auto;
  background:
    radial-gradient(circle at top, #fff8f3 0%, #f7e9e3 48%, #ead7cf 100%);
  position: relative;
  overflow-x: hidden;
  padding-bottom: 88px;
}

/* ヘッダー */
.karte-header {
  padding: 22px 20px 14px;
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.menu-btn,
.bell-btn {
  border: none;
  background: transparent;
  color: #7a5260;
  font-size: 28px;
  position: relative;
}

.bell-btn span {
  position: absolute;
  top: -6px;
  right: -8px;
  width: 22px;
  height: 22px;
  background: #c67995;
  color: white;
  border-radius: 50%;
  font-size: 13px;
  display: grid;
  place-items: center;
  font-family: sans-serif;
}

.title-area {
  text-align: center;
  flex: 1;
}

.title-area h1 {
  margin: 8px 0 8px;
  font-size: 28px;
  letter-spacing: 4px;
  font-weight: 600;
  color: #60404a;
}

.title-line {
  width: 210px;
  height: 1px;
  margin: 0 auto 14px;
  background: linear-gradient(90deg, transparent, #c9a36b, transparent);
}

.title-area p {
  margin: 0;
  font-size: 14px;
  color: #6c5357;
}

/* 検索 */
.search-box {
  margin-top: 8px;
  background: rgba(255,255,255,0.92);
  border-radius: 14px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 5px 18px rgba(91, 58, 64, 0.13);
}

.search-box span {
  font-size: 22px;
  color: #9a7882;
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  font-family: sans-serif;
  color: #5c454b;
}

.search-box button {
  border: none;
  background: #f1e7ea;
  color: #8b5d6f;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  font-size: 18px;
}

/* あかさたな */
.kana-tabs {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.kana-tabs button {
  min-width: 40px;
  height: 36px;
  border: none;
  background: rgba(255,255,255,0.9);
  color: #7c4e5d;
  border-radius: 9px;
  font-size: 19px;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(83, 54, 58, 0.14);
}

/* 本棚 */
.bookshelf {
  position: relative;
  height: 265px;
  background: linear-gradient(#9b7151, #704c35);
  border-top: 8px solid #856042;
  border-bottom: 8px solid #7b563c;
  box-shadow: inset 0 12px 18px rgba(0,0,0,0.22);
  overflow: hidden;
}

.shelf-board {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 24px;
  background: linear-gradient(#8b6244, #5c3d29);
}

.books {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 22px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  overflow-x: auto;
  padding: 0 12px 4px;
}

.book {
  width: 54px;
  height: 198px;
  border-radius: 7px 7px 4px 4px;
  box-shadow:
    inset -5px 0 8px rgba(0,0,0,0.14),
    4px 8px 14px rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.45);
  padding: 18px 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  transform-origin: bottom;
  transition: all .28s ease;
}
.book.active {
  width: 60px;
  height: 232px;
  transform: translateY(16px) rotate(-1deg);
  z-index: 5;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.75),
    0 12px 22px rgba(80, 50, 60, 0.25);
}
.book.pink {
  background: linear-gradient(90deg, #b96d82, #df9daf);
}

.book.purple {
  background: linear-gradient(90deg, #7b658e, #a995bc);
}

.book.brown {
  background: linear-gradient(90deg, #8a6654, #b8917d);
}

.book.green {
  background: linear-gradient(90deg, #627d69, #9caf9a);
}

.book.blue {
  background: linear-gradient(90deg, #6f7f95, #9eafc6);
}

.book.navy {
  background: linear-gradient(90deg, #4e5c73, #8390a8);
}
.book-name {
    writing-mode: vertical-rl;
    text-orientation: upright;
    white-space: nowrap;
    word-break: keep-all;
    overflow: visible;

    color: #fffaf0;
    font-size: 21px;
    letter-spacing: 3px;
    line-height: 1;
}
.book.active .book-name {
  color: #5FF0CF;
  font-size: 22px;
}

.book-date {
  color: #fff5e5;
  font-size: 12px;
  text-align: center;
  line-height: 1.25;
}

.book.active .book-date {
  color: #7e5b4f;
}

/* カルテカード */
.karte-card {
  position: relative;
  margin: -34px 10px 0;
  background: rgba(255,255,255,0.94);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -4px 22px rgba(80, 44, 52, 0.16);
  padding: 18px 12px 20px;
  z-index: 10;
}

.customer-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #f6dfe8;
  color: #8b4f66;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 16px;
  line-height: 1.2;
}

.customer-name {
  font-size: 24px;
  font-weight: bold;
}

.customer-name span {
  font-size: 17px;
  font-weight: normal;
}

.customer-name em {
  font-size: 12px;
  font-style: normal;
  border: 1px solid #e4b8c7;
  border-radius: 999px;
  color: #bb7190;
  padding: 3px 8px;
  margin-left: 5px;
}

.customer-date {
  font-size: 16px;
  color: #8b6b70;
  margin-top: 3px;
}

.customer-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.customer-actions button {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid #ead9de;
  background: white;
  color: #936576;
  font-size: 24px;
}

/* タブ */
.karte-tabs {
  margin-top: 18px;
  display: flex;
  overflow-x: auto;
  background: #fff;
  border: 1px solid #eadce0;
  border-radius: 14px 14px 0 0;
}

.karte-tabs button {
  white-space: nowrap;
  border: none;
  background: transparent;
  padding: 12px 15px;
  color: #8b6c73;
  font-size: 14px;
}

.karte-tabs button.active {
  background: linear-gradient(#b7839a, #986278);
  color: white;
  border-radius: 12px 12px 0 0;
  position: relative;
}

/* 中身 */
.karte-content {
  border: 1px solid #eadce0;
  border-top: none;
  border-radius: 0 0 16px 16px;
  padding: 12px;
  background: #fffefe;
}

.mini-panel,
.ai-panel {
  background: white;
  border: 1px solid #eadce0;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(80, 50, 60, 0.08);
}

.mini-panel {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 10px;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #a86d86;
  color: white;
  display: grid;
  place-items: center;
}

.panel-title {
  font-size: 17px;
  font-weight: bold;
  flex: 1;
}

.panel-arrow {
  color: #8d6572;
  font-size: 20px;
}

.ai-panel {
  padding: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-btn {
  border: 1px solid #e3c6df;
  background: #fff7ff;
  color: #9d61b6;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 13px;
}

.ai-panel ul {
  margin: 14px 0 0;
  padding-left: 24px;
  font-family: sans-serif;
  font-size: 15px;
  line-height: 1.9;
}


.book.active {
  width: 60px;
  height: 232px;
  transform: translateY(16px) rotate(-1deg);
  z-index: 5;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.75),
    0 12px 22px rgba(80, 50, 60, 0.25);
}

.book.active::after {
  content: "✨";
  position: absolute;
  top: -22px;
  right: -8px;
  font-size: 20px;
  animation: sparkle 1.4s ease-in-out infinite;
}

@keyframes sparkle {
  0% {
    opacity: 0;
    transform: scale(0.6) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.2) rotate(12deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.6) rotate(0deg);
  }
}
.kana-tabs button.active {
  background: linear-gradient(#b7839a, #986278);
  color: #fff;
  box-shadow: 0 6px 14px rgba(128, 72, 92, 0.28);
}
.book {
    position: relative;
    cursor: pointer;
    pointer-events: auto;
}

.book::before,
.book::after,
.book-shine {
    pointer-events: none;
}
.empty-books {
    color: #fff8ef;
    font-size: 16px;
    padding: 40px 20px;
    text-align: center;
    width: 100%;
}
.karte-card {
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.karte-card.karte-card-show {
    animation: cardSlideUp 0.45s ease;
}

@keyframes cardSlideUp {
    0% {
        opacity: 0.4;
        transform: translateY(18px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.karte-text {
  font-size: 15px;
  line-height: 1.8;
  color: #5c454b;
  padding: 12px 4px 4px;
  font-family: sans-serif;
}

.mini-text {
  margin-top: 4px;
  font-size: 13px;
  font-weight: normal;
  color: #7d646b;
  line-height: 1.5;
  font-family: sans-serif;
}

.karte-tabs button.active {
  background: linear-gradient(#b7839a, #986278);
  color: #fff;
  border-radius: 12px 12px 0 0;
}
.mini-text {
  margin-top: 4px;
  font-size: 13px;
  font-weight: normal;
  color: #7d646b;
  line-height: 1.4;
  font-family: sans-serif;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.info-item-box {
  background: #fff8fa;
  border: 1px solid #efdce4;
  border-radius: 14px;
  padding: 12px;
}

.info-label {
  font-size: 12px;
  color: #a36b80;
  margin-bottom: 5px;
  font-family: sans-serif;
}

.info-value {
  font-size: 16px;
  color: #4f3940;
  font-weight: bold;
  font-family: sans-serif;
}

.karte-section {
  margin-top: 12px;
  background: #fff8fa;
  border: 1px solid #efdce4;
  border-radius: 14px;
  padding: 13px 14px;
}

.section-title {
  font-size: 15px;
  font-weight: bold;
  color: #8f5b70;
  margin-bottom: 8px;
  font-family: sans-serif;
}

.section-body {
  font-size: 15px;
  line-height: 1.8;
  color: #5c454b;
  font-family: sans-serif;
}

.empty-note {
  background: #fff8fa;
  border: 1px dashed #e4c7d2;
  color: #96727e;
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  font-size: 14px;
  font-family: sans-serif;
}

#aiInstructionList {
  margin: 14px 0 0;
  padding-left: 22px;
  font-family: sans-serif;
  font-size: 15px;
  line-height: 1.8;
}

#aiInstructionList li {
  margin-bottom: 5px;
}

#aiInstructionList .instruction-heading {
  list-style: none;
  margin-left: -22px;
  margin-top: 12px;
  margin-bottom: 6px;
  color: #8f5b70;
  font-weight: bold;
  border-bottom: 1px solid #efdce4;
  padding-bottom: 4px;
}

.mini-text {
  margin-top: 4px;
  font-size: 13px;
  font-weight: normal;
  color: #7d646b;
  line-height: 1.5;
  font-family: sans-serif;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.photo-thumb {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: #f6e8ed;
  border: 1px solid #ead7df;
  box-shadow: 0 4px 10px rgba(80, 50, 60, 0.08);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-thumb {
  position: relative;
  overflow: hidden;
}

.photo-thumb img {
  position: relative;
  z-index: 1;
}

.photo-category {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 10;

  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(70, 45, 55, 0.78);
  color: #fff;

  font-size: 12px;
  font-weight: bold;
  font-family: sans-serif;
  line-height: 1;
  white-space: nowrap;
}
.mini-panel {
  align-items: flex-start;
  height: auto;
  min-height: 56px;
  max-height: 130px;
  overflow: hidden;
}

.mini-panel .panel-title {
  min-width: 0;
}

.mini-text {
  margin-top: 6px;
  max-height: 88px;
  overflow-y: auto;
  overflow-x: hidden;

  font-size: 13px;
  font-weight: normal;
  color: #7d646b;
  line-height: 1.5;
  font-family: sans-serif;

  word-break: break-word;
  overflow-wrap: anywhere;
  padding-right: 6px;
}

.kana-tabs button.active {
  background: linear-gradient(#b7839a, #986278);
  color: #fff;
  box-shadow: 0 6px 14px rgba(128, 72, 92, 0.28);
}
#clearSearchBtn {
  border: none;
  background: #f1e7ea;
  color: #8b5d6f;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

#clearSearchBtn:active {
  transform: scale(0.94);
}
.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}

.photo-modal.open {
  display: block;
}

.photo-modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(38, 25, 31, 0.72);
  backdrop-filter: blur(4px);
}

.photo-modal-content {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(92vw, 720px);
  max-height: 88vh;
  transform: translate(-50%, -50%);
  background: #fff8fa;
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.35);
}

.photo-modal-content img {
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  display: block;
  border-radius: 14px;
  background: #f2e5ea;
}

.photo-modal-close {
  position: absolute;
  right: -10px;
  top: -12px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: #8f5b70;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(0,0,0,0.24);
}

.photo-modal-category {
  position: absolute;
  right: 24px;
  bottom: 24px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(70, 45, 55, 0.82);
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  font-family: sans-serif;
}

.customer-sheet {
  font-family: sans-serif;
}

.sheet-section {
  margin-bottom: 16px;
}

.sheet-section-title {
  font-size: 15px;
  font-weight: bold;
  color: #8f5b70;
  margin-bottom: 10px;
  padding-left: 8px;
  border-left: 4px solid #b7839a;
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sheet-item {
  background: #fff8fa;
  border: 1px solid #efdce4;
  border-radius: 14px;
  padding: 12px;
}

.sheet-label {
  font-size: 12px;
  color: #a36b80;
  margin-bottom: 5px;
}

.sheet-value {
  font-size: 15px;
  color: #4f3940;
  font-weight: bold;
  word-break: break-word;
}

.sheet-note {
  background: #fff8fa;
  border: 1px solid #efdce4;
  border-radius: 14px;
  padding: 13px 14px;
  margin-bottom: 10px;
}

.sheet-note-label {
  font-size: 14px;
  font-weight: bold;
  color: #8f5b70;
  margin-bottom: 7px;
}

.sheet-note-body {
  font-size: 15px;
  line-height: 1.8;
  color: #5c454b;
}
@media (max-width: 520px) {
  .sheet-grid {
    grid-template-columns: 1fr;
  }
}
.risk-box {
  margin-top: 6px;
}

.risk-card {
  background: linear-gradient(180deg, #fffafc 0%, #fff4f7 100%);
  border: 1px solid #efdce4;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 8px 18px rgba(120, 80, 95, 0.08);
  font-family: sans-serif;
}

.risk-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.risk-main-title {
  font-size: 18px;
  font-weight: bold;
  color: #6f4c58;
  margin-bottom: 8px;
}

.risk-badge {
  display: inline-block;
  width: fit-content;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: bold;
  line-height: 1;
}

/* ASPの badgeStyle に合わせた色 */
.risk-badge.danger {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #ef4444;
}

.risk-badge.warning {
  background: #ffedd5;
  color: #ea580c;
  border: 1px solid #f97316;
}

.risk-badge.caution {
  background: #fef9c3;
  color: #d97706;
  border: 1px solid #f59e0b;
}

.risk-badge.good {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #22c55e;
}

.risk-badge.safe {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #10b981;
}

.risk-badge.none {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.risk-score-wrap {
  text-align: right;
  flex-shrink: 0;
}

.risk-score-num {
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
  color: #6f4c58;
}

.risk-score-num span {
  font-size: 17px;
  margin-left: 3px;
}

.risk-score-sub {
  margin-top: 4px;
  font-size: 12px;
  color: #9b7a84;
}

.risk-bar-wrap {
  margin-bottom: 14px;
}

.risk-bar-bg {
  width: 100%;
  height: 16px;
  background: linear-gradient(
    90deg,
    #10b981 0%,
    #22c55e 20%,
    #f59e0b 40%,
    #f97316 60%,
    #ef4444 80%,
    #dc2626 100%
  );
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.risk-bar-bg::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: rgba(255, 255, 255, 0.52);
  border-radius: 999px;
}

.risk-bar-fill {
  position: relative;
  z-index: 2;
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* スコア帯ごとのバー色 */
.risk-bar-fill.danger {
  background: linear-gradient(90deg, #f87171, #dc2626);
}

.risk-bar-fill.warning {
  background: linear-gradient(90deg, #fb923c, #ea580c);
}

.risk-bar-fill.caution {
  background: linear-gradient(90deg, #facc15, #d97706);
}

.risk-bar-fill.good {
  background: linear-gradient(90deg, #86efac, #16a34a);
}

.risk-bar-fill.safe {
  background: linear-gradient(90deg, #6ee7b7, #059669);
}

.risk-bar-fill.none {
  background: #cbd5e1;
}

.risk-bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: #a17f8a;
}

.risk-message {
  background: #fff;
  border: 1px solid #f0e0e6;
  border-radius: 14px;
  padding: 11px 12px;
  color: #5c454b;
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 10px;
}

.risk-note {
  background: #ffffff;
  border: 1px solid #f0e0e6;
  border-radius: 14px;
  padding: 12px 13px;
  margin-top: 10px;
}

.risk-note.ai {
  background: #fffaf2;
}

.risk-note-title {
  font-size: 13px;
  font-weight: bold;
  color: #8f5b70;
  margin-bottom: 6px;
}

.risk-note-body {
  font-size: 14px;
  line-height: 1.75;
  color: #5c454b;
}
.risk-star {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 32px;
  font-weight: bold;
  line-height: 1;

  text-shadow: 0 2px 6px rgba(80, 50, 60, 0.18);
  transition: all 0.25s ease;
}

/* データなし */
.risk-star.risk-none {
  color: #94a3b8;
}

/* 安泰 */
.risk-star.risk-safe {
  color: #10b981;
}

/* 良好 */
.risk-star.risk-good {
  color: #22c55e;
}

/* 注意：黄色を濃く */
.risk-star.risk-caution {
  color: #f59e0b;
  text-shadow:
    0 0 6px rgba(245, 158, 11, 0.45),
    0 2px 6px rgba(80, 50, 60, 0.18);
}

/* 警戒：オレンジ強め */
.risk-star.risk-warning {
  color: #f97316;
  text-shadow:
    0 0 8px rgba(249, 115, 22, 0.55),
    0 2px 7px rgba(124, 45, 18, 0.28);
}

/* 危険：赤く強調 */
.risk-star.risk-danger {
  color: #ef4444;
  text-shadow:
    0 0 8px rgba(239, 68, 68, 0.65),
    0 0 16px rgba(220, 38, 38, 0.45),
    0 2px 8px rgba(127, 29, 29, 0.35);
  animation: starDangerPulse 1.4s ease-in-out infinite;
}

@keyframes starDangerPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.12);
    opacity: 0.9;
  }
}
.kana-tabs button.active {
  background: linear-gradient(#b7839a, #986278);
  color: #fff;
  box-shadow: 0 6px 14px rgba(128, 72, 92, 0.28);
  transform: translateY(-1px);
}
.bookcase-switch {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 14px auto 8px;
  padding: 0 14px;
}

.bookcase-switch button {
  border: 1px solid #ead7df;
  background: rgba(255,255,255,0.88);
  color: #7b5362;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(80, 50, 60, 0.08);
}

.bookcase-switch button.active {
  background: linear-gradient(#b7839a, #986278);
  color: #fff;
  border-color: #986278;
  box-shadow: 0 6px 14px rgba(128, 72, 92, 0.28);
}

.kana-tabs-hidden {
  display: none;
}
.book-risk {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  background: rgba(80, 50, 60, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  border-radius: 999px;
  padding: 3px 7px;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}
.book {
  position: relative;
}

.book-risk-badge {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);

  writing-mode: horizontal-tb;
  text-orientation: mixed;

  min-width: 34px;
  padding: 4px 7px;
  border-radius: 999px;

  font-size: 11px;
  font-weight: bold;
  font-family: sans-serif;
  line-height: 1;
  text-align: center;

  box-shadow: 0 3px 8px rgba(50, 30, 40, 0.22);
}

/* 安泰 */
.book-risk-badge.safe {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #10b981;
}

/* 良好 */
.book-risk-badge.good {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #22c55e;
}

/* 注意 */
.book-risk-badge.caution {
  background: #fef9c3;
  color: #d97706;
  border: 1px solid #f59e0b;
}

/* 警戒 */
.book-risk-badge.warning {
  background: #ffedd5;
  color: #ea580c;
  border: 1px solid #f97316;
}

/* 危険 */
.book-risk-badge.danger {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #ef4444;
}

/* データなし */
.book-risk-badge.none {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #cbd5e1;
}
.book-pager {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 12px;

  margin: 10px auto 12px;
  padding: 6px 0;

  position: relative;
  z-index: 50;

  font-family: sans-serif;
}

.book-pager button {
  border: 1px solid #ead7df;
  background: #fff8fa;
  color: #7b5362;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(80, 50, 60, 0.08);
}

.book-pager button:disabled {
  opacity: 0.4;
  cursor: default;
}

#bookPageInfo {
  color: #7b5362;
  font-size: 13px;
  font-weight: bold;
}
.bookcase-switch button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* ========================================
   AIカルテブック 全体テーマ上書き
   ここだけで全体の雰囲気を調整する
======================================== */

:root {
  /* メイン：ローズ */
  --theme-main: #c67995;
  --theme-dark: #a85f7b;
  --theme-light: #e7b6c8;
  --theme-soft: #fff1f6;

  /* 外側：ミント */
  --outer-bg: #f4fffb;
  --outer-soft: #ecfbf5;
  --outer-line: #bfe8d7;
  --outer-line-soft: #dff2ea;

  /* カード */
  --card-bg: #ffffff;
  --card-border: #e8f3ee;

  /* 文字 */
  --text-main: #5a3f49;
  --text-sub: #8c6f79;
  --text-muted: #a38a94;

  /* 影 */
  --shadow-soft: 0 8px 22px rgba(120, 190, 165, 0.16);
  --shadow-rose: 0 8px 18px rgba(198, 121, 149, 0.25);
  --shadow-mini: 0 4px 12px rgba(120, 190, 165, 0.09);

  --radius-large: 24px;
  --radius-card: 18px;
  --radius-pill: 999px;
}

/* 全体背景 */
body {
  background: linear-gradient(180deg, var(--outer-bg), #ffffff) !important;
  color: var(--text-main);
}

/* メイン画面全体 */
.app,
.page,
.wrapper,
.main-container {
  background: transparent;
}

/* カルテ詳細カード */
.karte-card {
  background: linear-gradient(180deg, var(--outer-bg) 0%, #ffffff 100%) !important;
  border: 1px solid var(--outer-line) !important;
  border-radius: var(--radius-large) !important;
  box-shadow: var(--shadow-soft) !important;
}

/* 顧客ヘッダー */
.customer-head {
  background: linear-gradient(135deg, var(--outer-soft) 0%, #ffffff 100%) !important;
  border: 1px solid var(--outer-line) !important;
  border-radius: 20px !important;
  box-shadow: var(--shadow-mini) !important;
}

/* アバター */
.avatar {
  background: linear-gradient(135deg, var(--theme-main), var(--theme-light)) !important;
  color: #fff !important;
}

/* 選択中ボタン */
.karte-tabs button.active,
.bookcase-switch button.active,
.ai-btn {
  background: linear-gradient(135deg, var(--theme-main), var(--theme-dark)) !important;
  color: #fff !important;
  border-color: var(--theme-dark) !important;
  box-shadow: var(--shadow-rose) !important;
}

/* 通常ボタン */
.karte-tabs button,
.bookcase-switch button,
.book-pager button {
  background: #ffffff;
  color: var(--text-sub);
  border: 1px solid var(--card-border);
}

/* 中のカード */
.sheet-section,
.detail-block,
.ai-panel,
.mini-panel {
  background: var(--card-bg) !important;
  border: 1px solid var(--outer-line-soft) !important;
  border-radius: var(--radius-card) !important;
  box-shadow: var(--shadow-mini) !important;
}

/* セクション見出し */
.sheet-section-title {
  display: inline-block;
  background: var(--theme-soft) !important;
  color: var(--theme-dark) !important;
  border: 1px solid var(--theme-light) !important;
  border-radius: var(--radius-pill) !important;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: bold;
}

/* パネル見出し */
.panel-title,
.detail-block h3 {
  color: var(--theme-dark) !important;
}

/* アイコン */
.panel-icon {
  background: linear-gradient(135deg, var(--theme-main), var(--theme-light)) !important;
  color: #fff !important;
}

/* 写真カテゴリ */
.photo-category,
.photo-modal-category {
  background: linear-gradient(135deg, var(--theme-main), var(--theme-dark)) !important;
  color: #fff !important;
}

/* ページャー */
.book-pager {
  position: relative;
  z-index: 50;
}

.book-pager button {
  background: #ffffff !important;
  color: var(--theme-dark) !important;
  border: 1px solid var(--outer-line) !important;
  box-shadow: var(--shadow-mini) !important;
}

#bookPageInfo {
  color: var(--theme-dark) !important;
}

/* 空表示 */
.empty-note,
.empty-books {
  background: #ffffff !important;
  border: 1px dashed var(--outer-line) !important;
  color: var(--text-muted) !important;
}

/* 下部ナビは完全非表示 */
.bottom-nav,
nav.bottom-nav,
.footer-nav,
.mobile-nav {
  display: none !important;
}
.customer-resume-sheet {
    background: #fffdf8;
    border: 1px solid #e5d7bd;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 6px 18px rgba(80, 55, 20, 0.12);
    font-family: "Yu Gothic", "Meiryo", sans-serif;
    color: #3a2a1a;
}

/* 履歴書風 上部 */
.resume-header {
    display: flex;
    gap: 14px;
    align-items: stretch;
    padding: 12px;
    background: linear-gradient(180deg, #fffaf0, #fff3dc);
    border: 1px solid #e6d0aa;
    border-radius: 12px;
}

/* 写真枠 */
/* 写真を入れる外枠の設定 */
.resume-photo-box {
    width: 140px;
    height: 180px;
    min-width: 120px; /* 横から潰されるのを防ぐ */
    border: 1px solid #ccc;
    background-color: #f9f9f9;
    overflow: hidden; /* 枠からはみ出た写真をカット */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 枠の中に入る画像自体の設定 */
.resume-photo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 縦横比を維持したまま、枠いっぱいに綺麗に表示 */
}

/* 写真なし */
.resume-photo-empty {
    width: 100%;
    height: 100%;
    color: #b0966f;
    background: repeating-linear-gradient(
        -45deg,
        #fffaf0,
        #fffaf0 8px,
        #f7ecd8 8px,
        #f7ecd8 16px
    );
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.5;
    font-size: 13px;
    font-weight: bold;
}

/* 右側情報 */
.resume-main-info {
    flex: 1;
    min-width: 0;
}

.resume-name-line {
    border-bottom: 2px solid #d8b77e;
    padding-bottom: 6px;
    margin-bottom: 4px;
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.resume-name {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #2f2418;
}

.resume-sama {
    font-size: 14px;
    font-weight: bold;
}

.resume-kana {
    font-size: 12px;
    color: #7c6a55;
    margin-bottom: 10px;
}

/* 情報グリッド */
.resume-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.resume-info-item {
    background: #fff;
    border: 1px solid #ead9bd;
    border-radius: 8px;
    padding: 7px 8px;
}

.resume-info-label {
    font-size: 11px;
    color: #9a7d56;
    font-weight: bold;
    margin-bottom: 2px;
}

.resume-info-value {
    font-size: 13px;
    color: #33281d;
    font-weight: bold;
    word-break: break-all;
}

/* セクション */
.resume-section {
    margin-top: 12px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #ead9bd;
    border-radius: 12px;
}

.resume-section-title {
    font-size: 14px;
    font-weight: bold;
    color: #5c3d1e;
    border-left: 5px solid #d49a45;
    padding-left: 8px;
    margin-bottom: 10px;
}

/* メモ */
.resume-note {
    margin-bottom: 10px;
    background: #fffaf3;
    border: 1px solid #ead7bb;
    border-radius: 10px;
    overflow: hidden;
}

.resume-note-label {
    background: #f1dfc1;
    color: #5a3b1d;
    font-size: 12px;
    font-weight: bold;
    padding: 6px 9px;
}

.resume-note-body {
    font-size: 13px;
    line-height: 1.7;
    padding: 9px;
    color: #3a2a1a;
}

.empty-note {
    color: #9a8a78;
    background: #f8f3ea;
    border-radius: 8px;
    padding: 10px;
    font-size: 13px;
}

.profile-basic-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.profile-photo-side {
    width: 120px;
    min-width: 100px;
}

.profile-info-side {
    flex: 1;
    min-width: 0;
}


.resume-photo-empty {
    font-size: 12px;
    color: #a8875d;
    text-align: center;
    line-height: 1.5;
    font-weight: bold;
}

.profile-info-grid {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 520px) {
    .profile-basic-row {
        gap: 8px;
        align-items: flex-start;
    }

    .profile-photo-side {
        width: 150px;
        min-width: 150px;
    }

    .resume-photo-box {
        width: 150px;
        min-width: 150px;
        max-width: 150px;
        height: 190px;
        min-height: 190px;
        max-height: 190px;
    }

    .resume-photo-box img,
    .resume-photo {
        width: 150px !important;
        height: 190px !important;
        max-width: 150px !important;
        max-height: 190px !important;
        object-fit: cover !important;
    }

    .profile-info-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}
/* AI写真一覧エリア */
/* AI写真 全体グリッド */
.ai-photo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)); /* 2列 */
    gap: 10px;
    padding: 10px;
    box-sizing: border-box;
}

/* 写真カード */
.ai-photo-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

/* 画像の枠 */
.ai-photo-img-wrap {
    position: relative;   /* 2026-11-16 右上の × のため */
    width: 100%;
    aspect-ratio: 3 / 4;   /* 縦長カード */
    background: #f5f5f5;
    overflow: hidden;
}

/* 画像本体 */
.ai-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;     /* 一覧では見栄え重視 */
    display: block;
}

/* 下の情報エリア */
.ai-photo-info {
    padding: 7px 8px 8px;
    text-align: center;
}

/* タイトル */
.ai-photo-title {
    font-size: 13px;
    font-weight: bold;
    color: #333;
    line-height: 1.3;
}

/* No / sort */
.ai-photo-meta {
    margin-top: 3px;
    font-size: 10px;
    color: #888;
    line-height: 1.2;
}
/* 拡大表示モーダル */
.ai-photo-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(0,0,0,0.82);
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

/* 表示中 */
.ai-photo-modal.active {
    display: flex;
}

/* 拡大画像 */
.ai-photo-modal-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
}

/* 閉じるボタン */
.ai-photo-modal-close {
    position: fixed;
    top: 14px;
    right: 18px;
    color: #fff;
    font-size: 34px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
}

/* クリックできる感じ */
.ai-photo-card {
    cursor: pointer;
}
.ba-jump-btn {
    width: 100%;
    max-width: 420px;
    margin: 18px auto 10px auto;
    padding: 14px 18px;
    border: none;
    border-radius: 999px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    background: linear-gradient(135deg, #ffe1ec, #ffc5d8);
    color: #7a3f55;

    font-size: 15px;
    font-weight: bold;
    letter-spacing: 0.02em;

    cursor: pointer;
    box-shadow: 0 6px 16px rgba(200, 120, 150, 0.22);
    transition: 0.18s ease;
}

.ba-jump-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(200, 120, 150, 0.28);
    background: linear-gradient(135deg, #ffd6e6, #ffb8cf);
}

.ba-jump-btn:active {
    transform: translateY(1px);
    box-shadow: 0 3px 10px rgba(200, 120, 150, 0.18);
}

.ba-jump-btn-icon {
    font-size: 17px;
    line-height: 1;
}

.ba-jump-btn-arrow {
    font-size: 22px;
    line-height: 1;
    margin-left: 4px;
    color: #9b5065;
}

.ba-jump-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}
/* 2026-11-16 AI 生成画像の削除ボタン（右上の ×） */
.ai-photo-del {
    position: absolute; top: 6px; right: 6px; z-index: 3;
    width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff;
    background: rgba(220, 38, 38, .92); color: #fff; font-size: 16px; font-weight: bold; line-height: 1;
    display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.ai-photo-del:disabled { opacity: .5; }

/* 2026-11-16 次回のAI提案の画像の FUTURE の札（左上） */
.ai-photo-future {
    position: absolute; top: 6px; left: 6px; z-index: 3;
    padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: bold; letter-spacing: 2px;
    color: #1a1a1a; background: linear-gradient(to right bottom, #BF953F, #FCF6BA, #B38728);
    box-shadow: 0 2px 6px rgba(0,0,0,.25); pointer-events: none;
}

/* 2026-11-16 次回のAI提案：画像を選んでメッセージで送る */
.ai-photo-pick { position: absolute; bottom: 6px; left: 6px; z-index: 3; background: rgba(255,255,255,.95); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: bold; color: #1f2937; display: flex; align-items: center; gap: 4px; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.ai-photo-pick input { width: 16px; height: 16px; margin: 0; }
.fu-send { margin-top: 14px; padding: 12px; border-radius: 12px; background: #fffaf0; border: 1px solid #f3e2b3; }
.fu-send-txt { font-size: 14px; color: #3b2f2a; line-height: 1.7; }
.fu-send-btn { display: block; width: 100%; margin-top: 10px; border: 0; border-radius: 12px; padding: 13px; font-size: 15px; font-weight: bold; color: #fff; background: #06c755; cursor: pointer; }
.fu-send-btn:disabled { color: #7a8a8a; background: #eef2f2; cursor: default; }
.fu-send-msg { margin-top: 8px; font-size: 13px; font-weight: bold; color: #1f7a72; }

/* 2026-11-20 生成した画像に、作った年月日（右下） */
.ai-photo-date { position: absolute; bottom: 6px; right: 6px; z-index: 3; background: rgba(0,0,0,.62); color: #fff; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: bold; pointer-events: none; }
/* 2026-11-20 別角度AI生成の画像の札（FUTURE と同じ位置・青系） */
.ai-photo-angle { background: linear-gradient(to right bottom, #5b8def, #c9dcff, #3c6fd6); letter-spacing: 1px; }
