* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f4f5f7;
    color: #222;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
}

a {
    color: #2f7cf6;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.container {
    width: min(960px, calc(100% - 24px));
    margin: 24px auto;
}

.card {
    background: #fff;
    border: 1px solid #dfe3e8;
    border-radius: 16px;
    padding: 20px;
}

h1 {
    margin-top: 0;
}

h2 {
    margin-top: 28px;
}

label {
    display: block;
    font-weight: 700;
    margin: 14px 0 6px;
}

input,
textarea,
button,
select {
    font: inherit;
}

input[type=text],
input[type=password],
input[type=number],
textarea,
select {
    width: 100%;
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    padding: 12px;
    background: #fff;
}

button,
.button {
    display: inline-block;
    border: 0;
    border-radius: 10px;
    padding: 11px 16px;
    background: #2f7cf6;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

button:disabled,
.button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.secondary {
    background: #5f6b7a !important;
    color: #fff !important;
}

.danger {
    background: #c62828 !important;
    color: #fff !important;
}

.inline {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline > * {
    flex: 1;
}

.notice {
    padding: 10px 12px;
    border-radius: 10px;
    background: #eef5ff;
    margin: 10px 0;
    max-width: 100%;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.55;
}

.notice a,
.chat-header a {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.error {
    padding: 10px 12px;
    border-radius: 10px;
    background: #ffebee;
    color: #c62828;
    margin: 10px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

/* 鑑定タイプ選択 */
.type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 18px 0;
}

.type-card {
    display: block;
    padding: 18px;
    border: 1px solid #dfe3e8;
    border-radius: 14px;
    text-decoration: none;
    color: #222;
    background: #fff;
}

.type-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
}

.type-card span {
    color: #6b7280;
    font-size: 13px;
    line-height: 1.6;
}

.type-card.disabled {
    opacity: .55;
}

.type-card.available {
    opacity: 1;
}

/* チャット全体 */
.chat-shell {
    width: min(760px, 100%);
    max-width: 760px;
    margin: 0 auto;
    background: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}

.chat-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    border-bottom: 1px solid #dfe3e8;
    padding: 14px;
}

/* カウンター：基本もリアルタイムも3項目 */
.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.stat {
    min-width: 0;
    background: #f7f8fa;
    border-radius: 12px;
    padding: 9px 5px;
    text-align: center;
    font-size: 12px;
    line-height: 1.25;
    overflow: hidden;
}

.stat strong {
    display: block;
    font-size: 19px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 文字数制チャットの古い4項目版では3番目「合計」を非表示 */
.stats .stat:nth-child(3):not(:last-child) {
    display: none;
}

/* リアルタイム鑑定はPHP側で3項目のみ出力するため、そのまま3列 */
.realtime-shell .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.realtime-shell .stat strong {
    font-size: 18px;
}

/* progress */
.progress {
    height: 10px;
    border-radius: 999px;
    background: #e9edf2;
    overflow: hidden;
    margin-top: 10px;
}

.progress > div {
    height: 100%;
    width: 0;
    background: #2f7cf6;
}

/* メッセージ */
.messages {
    min-height: 45vh;
    padding: 16px 12px 20px;
    background: #f4f5f7;
}

.message-row {
    display: flex;
    margin: 10px 0;
    max-width: 100%;
    align-items: flex-start;
}

.message-row.customer {
    justify-content: flex-end;
}

.message-row.admin {
    justify-content: flex-start;
}

.bubble {
    max-width: 82%;
    min-width: 0;
    padding: 10px 12px;
    border-radius: 16px;
    white-space: normal;
    overflow-wrap: anywhere;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    line-height: 1.55;
    min-height: 0;
    height: auto;
}

.bubble > div:first-child {
    white-space: normal;
    margin: 0;
    padding: 0;
    line-height: 1.55;
}

.customer .bubble {
    background: #dff6d9;
}

.admin .bubble {
    background: #fff;
    border: 1px solid #dfe3e8;
}

.meta,
.small {
    color: #6b7280;
    font-size: 11px;
}

.bubble .meta {
    display: block;
    margin-top: 8px;
    padding: 0;
    line-height: 1.3;
}

.bubble a {
    display: block;
    max-width: 100%;
}

.chat-image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 10px;
    margin-top: 8px;
    margin-bottom: 0;
    border: 1px solid #dfe3e8;
}

/* 送信取消：通常非表示、長押し/右クリックでshowが付いた時だけ表示 */
.message-actions {
    display: none !important;
    margin-top: 6px !important;
    text-align: right !important;
}

.message-actions.show {
    display: block !important;
}

.cancel-link {
    display: none !important;
}

.message-actions.show .cancel-link {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: #2f7cf6 !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 8px !important;
    padding: 7px 12px !important;
    font-size: 12px !important;
    line-height: 1 !important;
    text-decoration: none !important;
}

.own-message .bubble {
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

/* 入力欄：PCはチャット下に自然配置 */
.composer {
    position: static;
    width: 100%;
    max-width: 100%;
    background: #fff;
    border-top: 1px solid #dfe3e8;
    padding: 10px 12px 14px;
    box-shadow: none;
}

.composer textarea {
    width: 100%;
    min-height: 42px;
    height: 42px;
    max-height: 90px;
    padding: 9px 14px;
    border-radius: 21px;
    line-height: 1.45;
    resize: none;
    overflow-y: auto;
    font-size: 16px;
}

.composer textarea:disabled,
.composer input:disabled {
    background: #f3f4f6;
    color: #888;
}

.composer-footer {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.composer .small,
#sendGuide {
    flex: 1 1 auto;
    min-width: 0;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.composer input[type="file"] {
    max-width: 170px;
    font-size: 12px;
}

.composer button,
.composer .button,
.composer label,
.composer .image-button {
    flex: 0 0 auto;
    min-height: 34px;
    height: 34px;
    max-height: 34px;
    padding: 0 16px;
    border-radius: 17px;
    font-size: 15px;
    line-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    white-space: nowrap;
}

#sendButton {
    min-height: 34px !important;
    height: 34px !important;
    max-height: 34px !important;
    line-height: 34px !important;
    border-radius: 17px !important;
}

/* リアルタイム操作 */
.realtime-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.realtime-controls button,
.realtime-controls .button {
    width: 100%;
    min-width: 0;
    text-align: center;
    padding-left: 8px;
    padding-right: 8px;
}

.pause-button,
button.pause-button {
    background: #5f6b7a !important;
    color: #fff !important;
}

/* スマホ */
@media (max-width: 720px) {
    body {
        background: #f4f5f7;
    }

    .container {
        width: 100%;
        margin: 0;
    }

    .card {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .type-grid {
        grid-template-columns: 1fr;
    }

    .chat-shell {
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
    }

    .chat-header {
        padding: 14px 14px 10px;
    }

    .notice {
        padding: 10px 12px;
        font-size: 13px;
        line-height: 1.5;
    }

    .stats,
    .realtime-shell .stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        margin-top: 10px;
    }

    .stat {
        padding: 8px 3px;
    }

    .stat strong,
    .realtime-shell .stat strong {
        font-size: 17px;
    }

    .messages {
        min-height: 55vh;
        padding: 16px 12px 105px;
    }

    .bubble {
        max-width: 88%;
    }

    .chat-image {
        max-width: 100%;
        max-height: 60vh;
    }

    /* スマホだけ下部固定 */
    .composer {
        position: fixed;
        left: 50%;
        bottom: 0;
        transform: translateX(-50%);
        z-index: 50;
        width: 100%;
        max-width: 100%;
        background: rgba(255,255,255,.97);
        border-top: 1px solid #e5e7eb;
        padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
        box-shadow: 0 -3px 12px rgba(0,0,0,.06);
    }

    .composer textarea {
        min-height: 40px;
        height: 40px;
        max-height: 72px;
        padding: 8px 14px;
        border-radius: 20px;
    }

    .composer-footer {
        gap: 8px;
        margin-top: 5px;
    }

    .composer input[type="file"] {
        max-width: 92px;
        font-size: 12px;
    }

    .composer button,
    .composer .button,
    .composer label,
    .composer .image-button,
    #sendButton {
        min-height: 32px !important;
        height: 32px !important;
        max-height: 32px !important;
        padding: 0 16px;
        border-radius: 16px;
        font-size: 14px;
        line-height: 32px !important;
    }

    .realtime-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .realtime-controls button,
    .realtime-controls .button {
        min-height: 44px;
        height: 44px;
        font-size: 16px;
        border-radius: 12px;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* =========================================================
   メール鑑定 Phase 1
   ========================================================= */

body.mail-app {
    margin: 0;
    background: #f6f3f8;
    color: #2a2530;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
    line-height: 1.7;
}

.mail-app a,
.mail-list-section a {
    color: inherit;
}

.mail-app button,
.mail-app input,
.mail-app textarea,
.mail-app select,
.mail-list-section button,
.mail-list-section input,
.mail-list-section textarea,
.mail-list-section select {
    font: inherit;
}

.mail-container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 64px;
}

.mail-container-narrow {
    max-width: 820px;
}

.mail-page-head,
.mail-list-section .section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.mail-page-head h1,
.mail-list-section .section-head h2,
.customer-head h1 {
    margin: 0;
    line-height: 1.35;
    color: #33253f;
}

.mail-page-head h1 {
    font-size: clamp(24px, 4vw, 34px);
}

.mail-list-section .section-head h2 {
    font-size: 24px;
}

.mail-eyebrow {
    margin: 0 0 4px;
    color: #7d5b91;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.customer-head {
    text-align: center;
    margin-bottom: 24px;
}

.customer-head .status-badge {
    margin-top: 12px;
}

.mail-card {
    margin-bottom: 20px;
    padding: 24px;
    border: 1px solid #e5ddeb;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(52, 36, 65, .06);
}

.mail-card h2,
.mail-card h3 {
    margin-top: 0;
    color: #3e2b4d;
}

.mail-card h2 {
    font-size: 21px;
}

.mail-card h3 {
    margin-top: 24px;
    font-size: 17px;
}

.mail-form {
    display: grid;
    gap: 20px;
}

.mail-form label {
    margin: 0;
}

.mail-form label > span,
.mail-form legend {
    display: block;
    margin-bottom: 7px;
    color: #493a53;
    font-weight: 700;
}

.mail-form em {
    margin-left: 6px;
    color: #b2274b;
    font-size: 12px;
    font-style: normal;
}

.mail-form small {
    margin-left: 6px;
    color: #776d7e;
    font-weight: 400;
}

.mail-form input[type="text"],
.mail-form input[type="password"],
.mail-form input[type="date"],
.mail-form input[type="file"],
.mail-form textarea,
.mail-form select,
.url-copy input {
    width: 100%;
    border: 1px solid #cfc4d5;
    border-radius: 9px;
    background: #fff;
    color: #28222d;
    padding: 12px 13px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.mail-form textarea {
    min-height: 180px;
    resize: vertical;
    line-height: 1.75;
}

.mail-form input:focus,
.mail-form textarea:focus,
.mail-form select:focus,
.url-copy input:focus {
    border-color: #8c62a5;
    box-shadow: 0 0 0 3px rgba(140, 98, 165, .14);
}

.mail-form fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

.radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.mail-form .radio-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    padding: 9px 12px;
    border: 1px solid #d8cedd;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 400;
}

.mail-form .radio-label input {
    width: auto;
    margin: 0;
}

.mail-form .radio-label span {
    margin: 0;
    font-weight: 500;
}

.mail-app .btn,
.mail-list-section .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 17px;
    border: 1px solid transparent;
    border-radius: 9px;
    text-decoration: none;
    font-weight: 700;
    line-height: 1.25;
    cursor: pointer;
}

.mail-app .btn-primary,
.mail-list-section .btn-primary {
    background: #76508d;
    color: #fff;
}

.mail-app .btn-primary:hover,
.mail-list-section .btn-primary:hover {
    background: #654078;
}

.mail-app .btn-success {
    background: #27785b;
    color: #fff;
}

.mail-app .btn-warning {
    background: #a66b18;
    color: #fff;
}

.mail-app .btn-danger,
.mail-list-section .btn-danger {
    background: #b4334d;
    color: #fff;
}

.mail-app .btn-light,
.mail-list-section .btn-light {
    background: #fff;
    border-color: #d9cedf;
    color: #4f3b5b;
}

.mail-list-section .btn-danger-outline {
    background: #fff;
    border-color: #cf7990;
    color: #a12645;
}

.mail-list-section .btn-small {
    min-height: 34px;
    padding: 6px 11px;
    font-size: 13px;
}

.mail-app .btn-block {
    width: 100%;
    min-height: 50px;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mail-app .alert,
.mail-list-section .alert {
    margin-bottom: 18px;
    padding: 13px 16px;
    border-radius: 9px;
    font-weight: 600;
}

.mail-app .alert-success,
.mail-list-section .alert-success {
    background: #e9f7f0;
    border: 1px solid #aed9c4;
    color: #1c6449;
}

.mail-app .alert-error,
.mail-list-section .alert-error {
    background: #fff0f2;
    border: 1px solid #e7b4bf;
    color: #94253e;
}

.mail-status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.mail-status-grid > div {
    padding: 17px;
    border: 1px solid #e4dbe9;
    border-radius: 12px;
    background: #fff;
}

.mail-status-grid span {
    display: block;
    margin-bottom: 5px;
    color: #817587;
    font-size: 12px;
}

.mail-app .status-badge,
.mail-list-section .status-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

.mail-app .status-draft,
.mail-list-section .status-draft {
    background: #ecebf0;
    color: #554e60;
}

.mail-app .status-pending,
.mail-list-section .status-pending {
    background: #fff1cd;
    color: #805b00;
}

.mail-app .status-delivered,
.mail-list-section .status-delivered {
    background: #e8efff;
    color: #285197;
}

.mail-app .status-completed,
.mail-list-section .status-completed {
    background: #e4f5ed;
    color: #24684f;
}

.url-copy {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px;
}

.detail-list dl {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    overflow: hidden;
    margin: 0;
    border: 1px solid #e3dbe7;
    border-radius: 10px;
    background: #e3dbe7;
}

.detail-list dl > div {
    padding: 14px;
    background: #fff;
}

.detail-list .detail-wide {
    grid-column: 1 / -1;
}

.detail-list dt {
    margin-bottom: 4px;
    color: #7c7082;
    font-size: 12px;
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
}

.prewrap {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.image-grid a {
    display: block;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    border: 1px solid #ded5e3;
    border-radius: 10px;
    background: #f7f4f8;
}

.image-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.notice-box,
.waiting-card {
    padding: 14px 16px;
    border-radius: 9px;
    background: #f7f1fa;
    color: #5b4567;
}

.result-card {
    border-color: #cdb7da;
    background: linear-gradient(180deg, #fff 0%, #fbf7fd 100%);
}

.result-body {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #e1d5e7;
    font-size: 16px;
    line-height: 1.9;
}

.danger-zone {
    border-color: #ebc7cf;
}

.danger-zone h2 {
    color: #9d2942;
}

.mail-list-section {
    margin: 28px 0;
}

.mail-list-section .table-wrap {
    overflow-x: auto;
    border: 1px solid #e2d9e7;
    border-radius: 12px;
    background: #fff;
}

.mail-list-section .mail-table {
    display: table;
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
    white-space: normal;
}

.mail-list-section .mail-table th,
.mail-list-section .mail-table td {
    padding: 13px 14px;
    border-bottom: 1px solid #ece5ef;
    text-align: left;
    vertical-align: middle;
}

.mail-list-section .mail-table th {
    background: #f7f3f9;
    color: #5d4b67;
    font-size: 13px;
}

.mail-list-section .mail-table tbody tr:last-child td {
    border-bottom: 0;
}

.mail-list-section .table-actions {
    display: flex;
    gap: 7px;
}

.mail-list-section .empty-state {
    text-align: center;
    color: #776d7e;
}

@media (max-width: 720px) {
    .mail-container {
        width: min(100% - 20px, 1120px);
        padding-top: 20px;
    }

    .mail-page-head,
    .mail-list-section .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .mail-page-head .btn,
    .mail-list-section .section-head .btn {
        width: 100%;
    }

    .mail-card {
        padding: 18px;
        border-radius: 11px;
    }

    .mail-status-grid {
        grid-template-columns: 1fr;
    }

    .detail-list dl {
        grid-template-columns: 1fr;
    }

    .detail-list .detail-wide {
        grid-column: auto;
    }

    .url-copy {
        grid-template-columns: 1fr;
    }

    .url-copy .btn {
        width: 100%;
    }

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

    .action-row .btn {
        width: 100%;
    }

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

    .mail-form .radio-label {
        border-radius: 9px;
    }

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

    .mail-list-section .table-wrap {
        overflow-x: auto;
    }

    .mail-list-section .mail-table {
        display: table;
        min-width: 700px;
        white-space: normal;
    }
}

/* =========================================================
   テキスト鑑定：管理画面一覧
   ========================================================= */
.text-reading-list {
    margin-top: 28px;
}

.text-reading-list-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 14px;
}

.text-reading-list-head h2 {
    margin: 0 0 4px;
}

.text-reading-list-head p {
    margin: 0;
}

.text-reading-table-wrap {
    width: 100%;
    overflow-x: auto;
    background: #fff;
    border: 1px solid #dfe3e8;
    border-radius: 14px;
}

.text-reading-table {
    min-width: 720px;
    margin: 0;
}

.text-reading-table th {
    background: #f7f8fa;
    color: #4b5563;
    font-size: 13px;
}

.text-reading-table tr:last-child td {
    border-bottom: 0;
}

.text-reading-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.text-reading-actions .button {
    padding: 8px 12px;
    white-space: nowrap;
}

.text-status {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.text-status.status-draft {
    background: #eceff3;
    color: #4b5563;
}

.text-status.status-pending {
    background: #fff3cd;
    color: #795b00;
}

.text-status.status-delivered {
    background: #e8f0ff;
    color: #24509a;
}

.text-status.status-completed {
    background: #e4f5ed;
    color: #21664c;
}

@media (max-width: 720px) {
    .text-reading-list {
        padding: 0 14px 18px;
    }

    .text-reading-list-head {
        align-items: stretch;
        flex-direction: column;
    }

    .text-reading-list-head .button {
        width: 100%;
        text-align: center;
    }

    .text-reading-table-wrap {
        border-radius: 10px;
    }
}


/* =========================================================
   テキスト鑑定：背景色
   ========================================================= */
body.mail-app.text-reading-app {
    background: #f4f4ff;
}

body.mail-app.text-reading-app .mail-container {
    background: transparent;
}

/* =========================================================
   鑑定管理：検索・アコーディオン・URLコピー
   ========================================================= */
.admin-dashboard {
    width: min(1120px, calc(100% - 24px));
}

.admin-title-row h1 {
    margin-bottom: 0;
}

.admin-search-box {
    margin: 22px 0;
    padding: 16px;
    border: 1px solid #dfe3e8;
    border-radius: 12px;
    background: #f8fafc;
}

.admin-search-box label {
    margin-top: 0;
}

.admin-search-box input[type="search"] {
    width: 100%;
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    padding: 12px;
    background: #fff;
    font: inherit;
}

.admin-search-box .small {
    min-height: 1.5em;
    margin: 7px 0 0;
}

.admin-accordion {
    margin: 16px 0;
    border: 1px solid #dfe3e8;
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

.admin-accordion > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 17px 18px;
    background: #f7f8fa;
    cursor: pointer;
    font-size: 21px;
    font-weight: 800;
    list-style: none;
}

.admin-accordion > summary::-webkit-details-marker,
.completed-accordion > summary::-webkit-details-marker {
    display: none;
}

.admin-accordion > summary::before {
    content: "▶";
    flex: 0 0 auto;
    margin-right: 8px;
    color: #2f7cf6;
    font-size: 14px;
    transition: transform .15s ease;
}

.admin-accordion[open] > summary::before {
    transform: rotate(90deg);
}

.admin-accordion > summary > span:first-child {
    margin-right: auto;
}

.accordion-count {
    color: #5f6b7a;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}

.accordion-body {
    padding: 18px;
}

.accordion-body h3 {
    margin: 0 0 12px;
    font-size: 17px;
}

.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.room-table {
    min-width: 760px;
    margin: 0;
    background: #fff;
}

.room-table th {
    background: #fafafa;
}

.room-table td:last-child {
    min-width: 180px;
}

.admin-action-links {
    white-space: nowrap;
}

.delete-link {
    color: #c62828 !important;
}

.completed-accordion {
    margin-top: 18px;
    border: 1px solid #e2e5e9;
    border-radius: 10px;
    overflow: hidden;
}

.completed-accordion > summary {
    padding: 12px 14px;
    background: #f5f6f8;
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}

.completed-accordion > summary::before {
    content: "▶";
    display: inline-block;
    margin-right: 8px;
    color: #6b7280;
    font-size: 12px;
    transition: transform .15s ease;
}

.completed-accordion[open] > summary::before {
    transform: rotate(90deg);
}

.completed-body {
    padding: 14px;
}

.searchable-room[hidden] {
    display: none !important;
}

.copy-url-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    padding: 7px 11px;
    border: 1px solid #2f7cf6;
    border-radius: 8px;
    background: #fff;
    color: #2f7cf6;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.copy-url-button:hover {
    background: #eef5ff;
}

.copy-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 1000;
    max-width: calc(100% - 32px);
    padding: 11px 16px;
    border-radius: 999px;
    background: #263238;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 16px);
    transition: opacity .18s ease, transform .18s ease;
}

.copy-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.copy-toast.is-error {
    background: #b3261e;
}

/* 個別鑑定画面：お客様URLコピー */
.customer-url-box {
    overflow: visible;
}

.customer-url-label {
    margin-bottom: 7px;
    font-weight: 700;
}

.customer-url-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.customer-url-row input {
    min-width: 0;
    width: 100%;
    border: 1px solid #dfe3e8;
    border-radius: 9px;
    padding: 9px 11px;
    background: #fff;
    font: inherit;
}

.customer-url-row button {
    min-width: 84px;
    padding: 9px 14px;
}

#copyCustomerUrlMessage {
    min-height: 1.4em;
    margin-top: 5px;
}

@media (max-width: 720px) {
    .admin-dashboard {
        width: 100%;
    }

    .admin-title-row {
        align-items: flex-start;
    }

    .admin-accordion {
        margin: 12px 0;
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }

    .admin-accordion > summary {
        padding: 15px 14px;
        font-size: 18px;
    }

    .accordion-count {
        max-width: 46%;
        font-size: 11px;
    }

    .accordion-body {
        padding: 14px;
    }

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

    .customer-url-row button {
        width: 100%;
    }

    .copy-toast {
        bottom: calc(18px + env(safe-area-inset-bottom));
    }
}

/* =========================================================
   Phase 2-A 顧客マイページ
   ========================================================= */
.mypage-body {
    margin: 0;
    background: #f4f4ff;
    color: #25212b;
}

.mypage-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid #dedbea;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(8px);
}

.mypage-header-inner {
    width: min(1080px, calc(100% - 28px));
    min-height: 64px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.mypage-brand {
    color: #49345a;
    font-weight: 800;
    text-decoration: none;
}

.mypage-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.mypage-header nav a {
    color: #5b4a65;
    font-size: 14px;
    text-decoration: none;
}

.mypage-container {
    width: min(1080px, calc(100% - 28px));
    margin: 0 auto;
    padding: 34px 0 70px;
}

.mypage-narrow {
    max-width: 720px;
}

.mypage-welcome {
    margin-bottom: 30px;
    padding: 28px;
    border: 1px solid #ddd7e8;
    border-radius: 18px;
    background: linear-gradient(135deg, #fff 0%, #f8f3ff 100%);
}

.mypage-welcome h1 {
    margin: 0 0 8px;
    color: #3e2b4d;
}

.mypage-welcome p:last-child {
    margin-bottom: 0;
}

.mypage-eyebrow {
    margin: 0 0 5px;
    color: #79548e;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
}

.mypage-card {
    margin-bottom: 20px;
    padding: 22px;
    border: 1px solid #ddd7e8;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 7px 22px rgba(55,38,67,.06);
}

.mypage-card h1,
.mypage-card h2 {
    margin-top: 0;
}

.mypage-form {
    display: grid;
    gap: 17px;
}

.mypage-form label {
    margin: 0;
}

.mypage-form input[type="email"],
.mypage-form input[type="password"],
.mypage-form input[type="text"] {
    width: 100%;
    margin-top: 7px;
    border: 1px solid #cec6d7;
    border-radius: 10px;
    padding: 12px;
    background: #fff;
}

.mypage-balance-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.mypage-balance-card {
    padding: 20px 14px;
    border: 1px solid #ded8e7;
    border-radius: 14px;
    background: #fff;
    text-align: center;
}

.mypage-balance-card span,
.mypage-balance-card small {
    display: block;
    color: #756a7a;
}

.mypage-balance-card strong {
    display: block;
    margin: 4px 0;
    color: #49345a;
    font-size: 34px;
    line-height: 1.2;
}

.mypage-section {
    margin-top: 34px;
}

.mypage-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.mypage-section-head h1,
.mypage-section-head h2 {
    margin: 0;
}

.mypage-service-list {
    display: grid;
    gap: 12px;
}

.mypage-service-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px;
    border: 1px solid #ddd7e8;
    border-radius: 14px;
    background: #fff;
}

.mypage-service-card.is-completed {
    background: #fafafa;
}

.mypage-service-card h3 {
    margin: 4px 0;
}

.mypage-service-card p {
    margin: 0;
    color: #6b6370;
    font-size: 13px;
}

.mypage-service-type {
    color: #76508d;
    font-size: 12px;
    font-weight: 800;
}

.admin-main-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.admin-customer-balances {
    margin: 22px 0;
}

.customer-linked-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.customer-linked-grid section {
    padding: 16px;
    border: 1px solid #dfe3e8;
    border-radius: 12px;
    background: #f8fafc;
}

.customer-linked-grid h3 {
    margin-top: 0;
}

.customer-linked-grid ul {
    margin: 0;
    padding-left: 20px;
}

@media (max-width: 720px) {
    .mypage-header-inner {
        min-height: 58px;
        align-items: flex-start;
        flex-direction: column;
        padding: 10px 0;
    }

    .mypage-header nav {
        gap: 10px;
    }

    .mypage-container {
        width: min(100% - 20px, 1080px);
        padding-top: 20px;
    }

    .mypage-welcome {
        padding: 20px;
        border-radius: 13px;
    }

    .mypage-balance-grid {
        grid-template-columns: 1fr;
    }

    .mypage-service-card {
        align-items: stretch;
        flex-direction: column;
    }

    .mypage-service-card .button {
        width: 100%;
        text-align: center;
    }

    .mypage-section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .customer-linked-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Phase 2-B 術鑑定・マイページ全面改修
   ========================================================= */
.ritual-admin-button {
    background: #8a4e8f !important;
    color: #fff !important;
}

.ritual-admin-grid {
    display: grid;
    gap: 16px;
}

.ritual-admin-card {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 18px;
    padding: 16px;
    border: 1px solid #ded8e7;
    border-radius: 14px;
    background: #fff;
}

.ritual-admin-card.is-inactive {
    opacity: .62;
}

.ritual-admin-thumb,
.ritual-customer-image,
.ritual-catalog-image {
    overflow: hidden;
    border-radius: 12px;
    background: #f4eff8;
}

.ritual-admin-thumb {
    aspect-ratio: 1 / 1;
}

.ritual-admin-thumb img,
.ritual-customer-image img,
.ritual-catalog-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ritual-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    min-height: 130px;
    background:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,.7), transparent 36%),
        linear-gradient(135deg, #80608f, #e1b76f);
    color: #fff;
    font-family: serif;
    font-size: 46px;
    font-weight: 700;
}

.ritual-admin-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.ritual-admin-title-row h2 {
    margin: 0;
}

.ritual-visibility {
    padding: 4px 8px;
    border-radius: 999px;
    background: #eceff3;
    color: #5f6670;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.ritual-visibility.is-active {
    background: #e6f5ed;
    color: #25634b;
}

.ritual-edit-preview {
    display: block;
    width: 180px;
    height: 180px;
    margin: 10px 0;
    border-radius: 12px;
    object-fit: cover;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.checkbox-label input {
    width: auto !important;
}

.ritual-filter-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px auto;
    gap: 10px;
    margin: 18px 0;
}

.ritual-filter-form input,
.ritual-filter-form select {
    width: 100%;
}

.ritual-status {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.ritual-status-pending { background: #fff0d6; color: #7a5400; }
.ritual-status-accepted { background: #e7f0ff; color: #295c9b; }
.ritual-status-waiting { background: #f6e8ff; color: #704088; }
.ritual-status-progress { background: #ffe6ed; color: #97324f; }
.ritual-status-result { background: #e2f6ee; color: #21694e; }
.ritual-status-completed { background: #e9ecef; color: #4d5660; }
.ritual-status-cancelled { background: #f1f1f1; color: #777; }

.ritual-order-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.ritual-order-meta-grid > div {
    padding: 14px;
    border: 1px solid #dfe3e8;
    border-radius: 11px;
    background: #f8fafc;
}

.ritual-order-meta-grid span {
    display: block;
    margin-bottom: 5px;
    color: #6b7280;
    font-size: 12px;
}

.ritual-result-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin: 14px 0;
}

.ritual-result-image-grid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    object-fit: cover;
}

.ritual-image-delete {
    display: block;
    margin-top: 5px;
    color: #c62828;
    font-size: 12px;
    text-align: center;
}

/* Premium mypage */
.mypage-premium {
    background:
        radial-gradient(circle at top left, rgba(137,91,156,.10), transparent 28%),
        #f4f4ff;
}

.mypage-premium-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    align-items: center;
    gap: 24px;
    margin-bottom: 20px;
    padding: 30px;
    border: 1px solid #d8cee3;
    border-radius: 20px;
    background:
        linear-gradient(135deg, rgba(255,255,255,.98), rgba(248,239,255,.96));
    box-shadow: 0 12px 34px rgba(67,42,80,.08);
}

.mypage-premium-hero h1 {
    margin: 2px 0 8px;
    color: #3d2749;
    font-size: clamp(28px, 5vw, 42px);
}

.mypage-premium-hero p:last-child {
    margin-bottom: 0;
    color: #675d6d;
}

.mypage-hero-symbol {
    display: grid;
    place-items: center;
    width: 130px;
    height: 130px;
    margin-left: auto;
    border: 1px solid rgba(255,255,255,.8);
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, rgba(255,255,255,.9), transparent 24%),
        linear-gradient(135deg, #8a5d9d, #d6a858);
    color: #fff;
    font-family: serif;
    font-size: 48px;
    box-shadow: 0 12px 28px rgba(86,54,100,.18);
}

.mypage-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 34px;
}

.mypage-summary-grid > div {
    padding: 18px;
    border: 1px solid #ded7e8;
    border-radius: 14px;
    background: #fff;
    text-align: center;
}

.mypage-summary-grid span,
.mypage-summary-grid small {
    color: #796e80;
}

.mypage-summary-grid strong {
    display: inline-block;
    margin: 0 5px;
    color: #52365f;
    font-size: 32px;
}

.mypage-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.mypage-section-title > span {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #7b568d;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.mypage-section-title p {
    margin: 0;
    color: #9b6a49;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .16em;
}

.mypage-section-title h2 {
    margin: 0;
    color: #3d2b48;
}

.ritual-customer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.ritual-customer-card {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid #ded5e5;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(59,40,69,.06);
}

.ritual-customer-image {
    min-height: 210px;
    border-radius: 0;
}

.ritual-customer-content {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
}

.ritual-customer-content h3 {
    margin: 10px 0 4px;
    color: #3f2a49;
}

.ritual-customer-content p {
    margin: 0 0 16px;
    color: #756b79;
    font-size: 13px;
}

.ritual-detail-button {
    margin-top: auto;
    background: #7d4c8d;
}

.ritual-catalog-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
}

.ritual-catalog-card {
    overflow: hidden;
    border: 1px solid #dfd5e5;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 7px 20px rgba(62,43,72,.05);
}

.ritual-catalog-image {
    aspect-ratio: 4 / 3;
    border-radius: 0;
}

.ritual-catalog-body {
    padding: 17px;
}

.ritual-catalog-body h3 {
    margin: 0 0 8px;
    color: #412b4c;
}

.ritual-catalog-body p {
    min-height: 4.8em;
    color: #6d6372;
    font-size: 13px;
    line-height: 1.6;
}

.ritual-catalog-body small {
    display: block;
    margin-bottom: 12px;
    color: #8a7e90;
}

.ritual-purchase-button {
    width: 100%;
    background: linear-gradient(90deg, #e08b2e, #ce6b34);
    text-align: center;
}

.ritual-contact-note {
    display: block;
    padding: 10px;
    border-radius: 8px;
    background: #f5f0f7;
    color: #6d5677;
    font-size: 12px;
    text-align: center;
}

.ritual-detail-page {
    max-width: 860px;
}

.mypage-back-link {
    display: inline-block;
    margin-bottom: 14px;
    text-decoration: none;
}

.ritual-detail-hero {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 22px;
    margin-bottom: 20px;
    padding: 22px;
    border: 1px solid #ddd3e5;
    border-radius: 18px;
    background: #fff;
}

.ritual-detail-hero > img,
.ritual-detail-placeholder {
    width: 220px;
    height: 220px;
    border-radius: 14px;
    object-fit: cover;
}

.ritual-detail-hero h1 {
    margin: 6px 0 12px;
    color: #3e2a49;
}

.ritual-timeline {
    position: relative;
    margin: 0;
    padding: 0 0 0 26px;
    list-style: none;
}

.ritual-timeline::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: #d9cde0;
}

.ritual-timeline li {
    position: relative;
    padding: 0 0 18px;
}

.ritual-timeline li::before {
    content: "";
    position: absolute;
    left: -24px;
    top: 6px;
    width: 10px;
    height: 10px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #805691;
    box-shadow: 0 0 0 1px #cdbbd6;
}

.ritual-timeline span {
    display: block;
    color: #887e8c;
    font-size: 12px;
}

.ritual-result-panel {
    border-color: #cdb7da;
    background: linear-gradient(180deg, #fff, #fbf6ff);
}

.ritual-result-text {
    margin: 16px 0;
    padding-top: 16px;
    border-top: 1px solid #dfd1e5;
    line-height: 1.9;
}

.ritual-result-button {
    background: #784986;
}

.ritual-waiting-panel {
    text-align: center;
}

.history-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0;
}

.history-filter a {
    padding: 8px 13px;
    border: 1px solid #d8cfdf;
    border-radius: 999px;
    background: #fff;
    color: #5c4a65;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.history-filter a.is-active {
    border-color: #785188;
    background: #785188;
    color: #fff;
}

@media (max-width: 900px) {
    .ritual-customer-grid {
        grid-template-columns: 1fr;
    }

    .ritual-catalog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .ritual-admin-card {
        grid-template-columns: 100px minmax(0, 1fr);
    }

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

    .ritual-order-meta-grid {
        grid-template-columns: 1fr;
    }

    .mypage-premium-hero {
        grid-template-columns: 1fr;
        padding: 22px;
    }

    .mypage-hero-symbol {
        width: 90px;
        height: 90px;
        margin: 0;
        font-size: 34px;
    }

    .mypage-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
    }

    .mypage-summary-grid > div {
        padding: 12px 5px;
    }

    .mypage-summary-grid strong {
        font-size: 25px;
    }

    .ritual-customer-card {
        grid-template-columns: 120px minmax(0, 1fr);
    }

    .ritual-customer-image {
        min-height: 190px;
    }

    .ritual-catalog-grid {
        grid-template-columns: 1fr;
    }

    .ritual-catalog-body p {
        min-height: 0;
    }

    .ritual-detail-hero {
        grid-template-columns: 1fr;
    }

    .ritual-detail-hero > img,
    .ritual-detail-placeholder {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }
}

.mypage-summary-grid-two{grid-template-columns:repeat(2,minmax(0,1fr));}
@media(max-width:720px){.mypage-summary-grid-two{grid-template-columns:repeat(2,minmax(0,1fr));}}

.pdf-export-actions {
  display: flex !important;
  justify-content: flex-start !important;
  align-items: center !important;
  width: auto !important;
}

.pdf-export-actions > a.pdf-small-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;

  padding: 10px 8px !important;
  font-size: 10px !important;
  line-height: 1 !important;
  border-radius: 5px !important;
}
/* =========================================================
   Phase 2-C: サービス・メニュー管理 / マイページ掲載
   ========================================================= */
.service-menu-admin-head{align-items:flex-start;gap:20px}.service-menu-admin-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.service-category-sort{display:grid;gap:18px;margin-top:20px}.service-sort-category{border:1px solid #ddd4ec;border-radius:16px;background:#faf8ff;overflow:hidden}.service-sort-category.is-inactive,.service-sort-item.is-inactive{opacity:.58}.service-sort-category-head{display:flex;align-items:center;gap:10px;padding:13px 14px;background:#eee9f8;border-bottom:1px solid #ddd4ec}.service-sort-category-head h2{margin:0;flex:1;font-size:20px}.drag-handle{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:9px;background:#fff;border:1px solid #cfc3df;font-size:24px;line-height:1;cursor:grab;touch-action:none;user-select:none}.drag-handle:active{cursor:grabbing}.service-item-sort{display:grid;gap:10px;padding:12px;min-height:54px}.service-sort-item{display:grid;grid-template-columns:38px 66px minmax(0,1fr) auto;gap:12px;align-items:center;padding:10px;border:1px solid #e2dcec;border-radius:13px;background:#fff}.service-sort-thumb{width:66px;height:50px;border-radius:9px;overflow:hidden;background:#eee9f8;display:flex;align-items:center;justify-content:center;color:#6d4f86;font-size:12px}.service-sort-thumb img{width:100%;height:100%;object-fit:cover}.service-sort-main h3{margin:0 0 4px;font-size:16px}.service-sort-main p{margin:4px 0 0;font-size:13px;color:#666}.service-sort-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}.compact-button{padding:8px 12px!important;font-size:13px!important}.service-admin-badges,.service-link-badges{display:flex;gap:6px;flex-wrap:wrap}.service-admin-badges span,.service-link-badges span{display:inline-flex;align-items:center;border-radius:999px;padding:3px 9px;font-size:11px;font-weight:700;background:#ede4fa;color:#623f83}.service-link-badges .is-limited{background:#fff0df;color:#9a5713}.service-link-badges .is-campaign{background:#ffe8ef;color:#a33355}.service-order-savebar{position:sticky;bottom:12px;margin-top:18px;text-align:center;z-index:20}.service-order-savebar button{box-shadow:0 8px 24px rgba(62,38,86,.2)}.is-dragging{opacity:.92;box-shadow:0 14px 35px rgba(48,27,67,.28);transform:rotate(.4deg)}.sortable-placeholder{border:2px dashed #8b6aa5;border-radius:14px;background:#f1ebf8;margin:2px 0}.service-label-fieldset{margin:18px 0;padding:14px 16px;border:1px solid #d8cce7;border-radius:12px}.service-label-fieldset legend{padding:0 7px;font-weight:700}.service-label-fieldset .checkbox-label{margin:8px 0}.mypage-service-catalog{display:grid;gap:30px}.mypage-service-category-title{margin:0 0 14px;padding:0 0 8px;border-bottom:1px solid #d8cce7;color:#4e3563;font-size:20px}.service-link-placeholder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,#ece5f7,#faf7ff);color:#6d4f86;font-size:22px;font-family:serif}.service-link-card .ritual-catalog-body{display:flex;flex-direction:column}.service-link-card .ritual-catalog-body p{flex:1}.service-link-card .ritual-purchase-button{margin-top:auto}.service-link-badges{min-height:22px;margin-bottom:7px}
@media(max-width:760px){.service-menu-admin-head{display:block}.service-menu-admin-actions{justify-content:flex-start}.service-sort-category-head{flex-wrap:wrap}.service-sort-category-head h2{font-size:18px}.service-sort-item{grid-template-columns:34px 54px minmax(0,1fr)}.service-sort-thumb{width:54px;height:48px}.service-sort-actions{grid-column:2/4;justify-content:flex-start}.service-order-savebar{bottom:8px}.service-link-grid{grid-template-columns:1fr}.mypage-service-category-title{font-size:18px}}

/* =========================================================
   マイページ表示整理 2026-07-21
   01 サービスメニュー / 02 進行中 / 03 保有チケット / 04 履歴
   ========================================================= */
.mypage-premium-hero{
    grid-template-columns:minmax(0,1fr);
}

.service-link-list{
    display:grid;
    gap:0;
    overflow:hidden;
    border:1px solid #ded6e5;
    border-radius:16px;
    background:#fff;
    box-shadow:0 7px 20px rgba(62,43,72,.05);
}

.service-link-row{
    display:grid;
    grid-template-columns:minmax(0,1fr) 118px;
    gap:18px;
    align-items:center;
    min-height:142px;
    padding:16px;
    border-bottom:1px solid #e1dbe6;
}

.service-link-row:last-child{
    border-bottom:0;
}

.service-link-row-content{
    min-width:0;
}

.service-link-row-content h3{
    margin:5px 0 7px;
    color:#3f2a49;
    font-size:18px;
    line-height:1.45;
}

.service-link-row-content p{
    margin:0 0 10px;
    color:#6d6372;
    font-size:13px;
    line-height:1.65;
    overflow-wrap:anywhere;
}

.service-link-detail{
    display:inline-flex;
    align-items:center;
    color:#744c82;
    font-size:13px;
    font-weight:700;
    text-decoration:none;
}

.service-link-detail::after{
    content:"›";
    margin-left:5px;
    font-size:17px;
    line-height:1;
}

.service-link-row-image{
    display:block;
    width:118px;
    height:118px;
    overflow:hidden;
    border-radius:6px;
    background:#f0ebf5;
    text-decoration:none;
}

.service-link-row-image img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
}

.service-link-row-image .service-link-placeholder{
    width:100%;
    height:100%;
    font-size:18px;
}

@media(max-width:720px){
    .mypage-premium-hero{
        grid-template-columns:1fr;
    }

    .service-link-row{
        grid-template-columns:minmax(0,1fr) 104px;
        gap:13px;
        min-height:128px;
        padding:14px;
    }

    .service-link-row-image{
        width:104px;
        height:104px;
    }

    .service-link-row-content h3{
        font-size:16px;
    }

    .service-link-row-content p{
        font-size:12px;
        line-height:1.55;
    }

    .service-link-badges{
        min-height:0;
    }
}

@media(max-width:390px){
    .service-link-row{
        grid-template-columns:minmax(0,1fr) 92px;
        gap:10px;
        padding:12px;
    }

    .service-link-row-image{
        width:92px;
        height:92px;
    }
}

/* =========================================================
   マイページ調整 2026-07-21
   ・セクション番号を非表示
   ・保有チケットカードをコンパクト化
   ========================================================= */
.mypage-section-title{
    gap:0;
}

.mypage-balance-card{
    min-height:72px;
    padding:11px 18px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:7px;
}

.mypage-balance-card span{
    margin-right:auto;
    text-align:left;
    font-size:15px;
}

.mypage-balance-card strong{
    display:inline-block;
    margin:0;
    font-size:30px;
    line-height:1;
}

.mypage-balance-card small{
    display:inline-block;
    align-self:flex-end;
    margin-bottom:2px;
    font-size:12px;
}

@media (max-width:720px){
    .mypage-balance-card{
        min-height:70px;
        padding:10px 18px;
    }

    .mypage-balance-card span{
        font-size:15px;
    }

    .mypage-balance-card strong{
        font-size:29px;
    }
}


/* =========================================================
   マイページ微調整 2026-07-21
   ・保有数を「0/枚・0/回・0/分」で一体表示
   ・進行中／回答済みサマリーを約半分の高さへ縮小
   ========================================================= */
.mypage-balance-value{
    display:inline-flex;
    align-items:baseline;
    flex:0 0 auto;
    white-space:nowrap;
    margin-left:auto;
}

.mypage-balance-card .mypage-balance-value strong{
    margin:0;
}

.mypage-balance-card .mypage-balance-value small{
    align-self:auto;
    margin:0 0 0 1px;
    line-height:1;
}

.mypage-summary-grid-two > div{
    min-height:42px;
    padding:5px 8px;
    display:flex;
    align-items:center;
    justify-content:center;
}

.mypage-summary-grid-two strong{
    margin:0 4px;
    font-size:23px;
    line-height:1;
}

.mypage-summary-grid-two span,
.mypage-summary-grid-two small{
    line-height:1.15;
}

@media(max-width:720px){
    .mypage-summary-grid-two > div{
        min-height:40px;
        padding:4px 6px;
    }

    .mypage-summary-grid-two strong{
        font-size:22px;
    }
}

/* =========================================================
   マイページ最終調整 2026-07-21
   ・保有数を右端に固定
   ・進行中／回答済み集計欄を明示的に低く固定
   ========================================================= */

/* 左側のサービス名だけに余白を適用する */
.mypage-balance-card > span:not(.mypage-balance-value){
    margin-right:auto;
    text-align:left;
    font-size:15px;
}

/* 0/枚・0/回・0/分は右端に固定 */
.mypage-balance-card > .mypage-balance-value{
    display:inline-flex;
    align-items:baseline;
    justify-content:flex-end;
    flex:0 0 auto;
    width:auto;
    margin-left:auto;
    margin-right:0;
    text-align:right;
    white-space:nowrap;
}

.mypage-balance-card > .mypage-balance-value strong,
.mypage-balance-card > .mypage-balance-value small{
    margin-right:0;
    text-align:right;
}

/* 進行中・回答済みの白枠を約半分の高さに固定 */
.mypage-summary-grid.mypage-summary-grid-two{
    gap:8px;
}

.mypage-summary-grid.mypage-summary-grid-two > div{
    height:42px !important;
    min-height:42px !important;
    padding:0 6px !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    box-sizing:border-box;
}

.mypage-summary-grid.mypage-summary-grid-two span,
.mypage-summary-grid.mypage-summary-grid-two small,
.mypage-summary-grid.mypage-summary-grid-two strong{
    line-height:1 !important;
}

.mypage-summary-grid.mypage-summary-grid-two strong{
    margin:0 4px !important;
    font-size:21px !important;
}

@media(max-width:720px){
    .mypage-summary-grid.mypage-summary-grid-two > div{
        height:38px !important;
        min-height:38px !important;
        padding:0 4px !important;
    }

    .mypage-summary-grid.mypage-summary-grid-two strong{
        font-size:20px !important;
    }
}


/* =========================================================
   お客様番号表示
   ========================================================= */
.mypage-customer-number{
  margin:6px 0 10px;
  font-size:14px;
  font-weight:700;
  letter-spacing:.04em;
  color:#70516f;
}
