/* ReLUMI 顧客カルテ v26 */

:root {
    --primary-navy: #0F172A;
    --primary-gold: #B8860B;
    --secondary-gold: #D4AF37;
    --bg-light: #F8FAFC;
    --text-dark: #1E293B;
    --text-muted: #64748B;
    --border-col: #E2E8F0;
}

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

body {
    font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

/* ===== Header ===== */
header {
    background: var(--primary-navy);
    color: white;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 44px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.logo { font-weight: 700; font-size: 1rem; letter-spacing: 0.02em; }
.logo i { color: var(--secondary-gold); margin-right: 6px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.sync-status { color: rgba(255,255,255,0.7); font-size: 0.75rem; white-space: nowrap; }
.btn-header {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-header:hover { background: rgba(255,255,255,0.2); }
.btn-header-gold { background: var(--primary-gold); border-color: var(--primary-gold); font-weight: 700; }
.btn-header-gold:hover { background: var(--secondary-gold); }

/* ===== Main ===== */
.main-view { flex: 1; padding: 10px 14px; max-width: 960px; margin: 0 auto; width: 100%; }

/* ===== 50音ナビ ===== */
.kana-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 2行×5列 */
    gap: 5px;
    margin-bottom: 8px;
}
.kana-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    background: white;
    border: 1.5px solid var(--border-col);
    border-radius: 8px;
    padding: 8px 4px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-navy);
    cursor: pointer;
    transition: all 0.12s;
    min-height: 44px;
    /* タップ領域確保 */
    -webkit-tap-highlight-color: transparent;
}
.kana-btn:hover { border-color: var(--primary-gold); color: var(--primary-gold); }
.kana-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.kana-btn.active {
    background: var(--primary-navy);
    border-color: var(--primary-navy);
    color: white;
}
.kana-other {
    grid-column: span 1;
    font-size: 0.9rem;
}
.kana-count {
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0.75;
}

/* デスクトップは横1行 */
@media (min-width: 600px) {
    .kana-nav {
        grid-template-columns: repeat(11, 1fr); /* あ〜わ+その他 */
        gap: 6px;
    }
    .kana-btn { padding: 8px 4px; min-height: 44px; font-size: 1rem; }
    .kana-other { grid-column: span 1; }
}

/* ===== 検索 ===== */
.search-wrap { margin-bottom: 8px; }
.search-box {
    width: 100%;
    padding: 8px 14px;
    border: 1.5px solid var(--border-col);
    border-radius: 999px;
    font-size: 0.95rem;
    background: white;
    -webkit-appearance: none;
}
.search-box:focus {
    outline: none;
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 3px rgba(184,134,11,0.12);
}

/* ===== リストプレースホルダー ===== */
.list-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 48px 20px;
    font-size: 0.92rem;
    line-height: 2;
}
.list-placeholder i { font-size: 1.8rem; opacity: 0.4; margin-bottom: 8px; display: block; }

/* ===== List ===== */
.list-container {
    background: white;
    border: 1px solid var(--border-col);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-col);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.list-item:last-child { border-bottom: none; }
.list-item:active { background: #f5f7fa; }
@media (hover: hover) { .list-item:hover { background: #f5f7fa; } }
.list-item-name { font-weight: 600; color: var(--primary-navy); }
.list-item-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.list-item-date { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; margin-left: 8px; }
.empty { padding: 36px 20px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* ===== Detail header ===== */
.detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.btn-back {
    background: white;
    border: 1px solid var(--border-col);
    color: var(--primary-navy);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
}
.btn-back:hover { background: #f5f7fa; }
.detail-title { flex: 1; min-width: 0; }
.detail-name { font-size: 1.2rem; font-weight: 700; color: var(--primary-navy); }
.detail-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.detail-body { display: flex; flex-direction: column; gap: 16px; }

/* ===== Card ===== */
.card {
    background: white;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--border-col);
}
.section-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--primary-navy);
    border-left: 4px solid var(--primary-gold);
    padding-left: 10px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
}
.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.section-title-row .section-title { margin-bottom: 0; }
.btn-link {
    background: none;
    border: none;
    color: var(--primary-gold);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    white-space: nowrap;
}
.hint { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; }

/* ===== Memo ===== */
.memo-box {
    background: #fffbea;
    border: 1px solid #fce9a4;
    border-radius: 8px;
    padding: 12px 14px;
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #5a4a1a;
}
.memo-box.memo-empty {
    background: #f7f7f7;
    border-color: var(--border-col);
    color: var(--text-muted);
    font-style: italic;
}

/* ===== Timeline ===== */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.timeline-item {
    border: 1px solid var(--border-col);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fafbfc;
}
.timeline-date {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-navy);
    margin-bottom: 5px;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--border-col);
}
.timeline-msg {
    font-size: 0.9rem;
    white-space: pre-wrap;
    line-height: 1.65;
}

/* ===== 画像グリッド ===== */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.image-grid-full { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.image-card {
    display: block;
    border: 1px solid var(--border-col);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    background: #f3f4f6;
}
.image-card:active { opacity: 0.85; }
@media (hover: hover) { .image-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); } }
.log-image { width: 100%; height: 140px; object-fit: cover; display: block; }
.image-caption {
    padding: 5px 8px;
    font-size: 0.7rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-col);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== フェーズボタン ===== */
.phase-group { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.phase-btn {
    padding: 10px 18px;
    border: 2px solid var(--border-col);
    border-radius: 999px;
    background: white;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.12s;
    -webkit-tap-highlight-color: transparent;
}
.phase-btn:hover { border-color: var(--primary-gold); color: var(--primary-gold); }
.phase-btn.active { background: var(--primary-navy); border-color: var(--primary-navy); color: white; }

/* ===== フェーズプレビュー ===== */
.phase-content { margin-bottom: 12px; }
.preview-item {
    border: 1px solid var(--border-col);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fafbfc;
    margin-bottom: 8px;
}
.preview-head {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-navy);
    margin-bottom: 5px;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--border-col);
}
.preview-msg { font-size: 0.88rem; white-space: pre-wrap; line-height: 1.65; }

/* ===== ラジオ ===== */
.form-block { margin-bottom: 12px; }
.form-block label:first-child {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-navy);
    margin-bottom: 6px;
}
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-item { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.9rem; }
.radio-item input[type="radio"] { accent-color: var(--primary-gold); width: 18px; height: 18px; flex-shrink: 0; }

/* ===== LINE actions ===== */
.line-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; margin-bottom: 10px; }
.btn-gold {
    background: linear-gradient(135deg, var(--primary-gold), var(--secondary-gold));
    color: white;
    border: none;
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(184,134,11,0.3);
    font-size: 0.92rem;
    transition: transform 0.12s, box-shadow 0.12s;
    -webkit-tap-highlight-color: transparent;
}
.btn-gold:active { transform: scale(0.97); }
@media (hover: hover) { .btn-gold:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(184,134,11,0.35); } }

/* ===== LINE output ===== */
.line-output-wrap { margin-top: 12px; border: 1px solid var(--border-col); border-radius: 8px; overflow: hidden; }
.line-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f5f7fa;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-col);
}
.btn-copy {
    background: white;
    border: 1px solid var(--border-col);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.76rem;
    color: var(--primary-navy);
}
.line-output {
    padding: 12px 14px;
    font-family: inherit;
    font-size: 0.88rem;
    white-space: pre-wrap;
    line-height: 1.7;
    background: white;
    max-height: 400px;
    overflow-y: auto;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
}
.modal-content {
    background: white;
    border-radius: 14px;
    width: 100%;
    max-width: 480px;
    padding: 22px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    max-height: 92vh;
    overflow-y: auto;
}
.modal-content h3 {
    color: var(--primary-navy);
    border-bottom: 1px solid var(--border-col);
    padding-bottom: 10px;
    margin-bottom: 16px;
    font-size: 1rem;
}
.form-block input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-col);
    border-radius: 6px;
    font-size: 0.9rem;
    -webkit-appearance: none;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.btn-primary {
    background: var(--primary-navy); color: white;
    border: none; padding: 9px 20px; border-radius: 6px; font-weight: 600; cursor: pointer;
}
.btn-secondary {
    background: white; border: 1px solid var(--border-col); color: var(--text-dark);
    padding: 9px 20px; border-radius: 6px; cursor: pointer;
}

/* ===== Misc ===== */
.version-tag {
    position: fixed; bottom: 8px; right: 8px;
    background: rgba(0,0,0,0.5); color: white;
    padding: 2px 8px; border-radius: 999px;
    font-size: 9px; pointer-events: none; z-index: 9999;
}
