:root {
    --color-primary: #1b6e4f;
    --color-primary-dark: #124d38;
    --color-primary-light: #e8f3ee;
    --color-accent: #e07b00;
    --color-accent-dark: #c96a00;
    --color-text: #222;
    --color-bg: #f7f8f7;
    --color-card: #ffffff;
    --color-border: #d9dcd9;
    --color-error: #c0392b;
    --shadow-sm: 0 1px 3px rgba(18, 77, 56, 0.08);
    --shadow-md: 0 8px 24px rgba(18, 77, 56, 0.1);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    overflow-x: hidden;
}

h1, h2, h3, p {
    overflow-wrap: anywhere;
}

.site-header {
    background: var(--color-primary);
    color: #fff;
    padding: 16px 20px;
}

.site-header__inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 12px;
    justify-content: space-between;
}

.site-header__logo {
    font-size: 1.4rem;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
}

.site-header__tagline {
    font-size: 0.85rem;
    opacity: 0.9;
}

.site-header__tagline {
    display: none;
}

@media (min-width: 640px) {
    .site-header__tagline {
        display: inline;
    }
}

.site-header__mypage {
    color: #fff;
    font-size: 0.85rem;
    font-weight: bold;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 999px;
    padding: 5px 14px;
    white-space: nowrap;
}

.site-header__mypage:hover {
    background: rgba(255, 255, 255, 0.15);
}

.stepper {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
}

.stepper ol {
    max-width: 960px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    gap: 24px;
    list-style: none;
    font-size: 0.9rem;
    color: #999;
}

.stepper li.is-current {
    color: var(--color-primary);
    font-weight: bold;
}

.page {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 20px 64px;
}

.hero {
    text-align: center;
    padding: 48px 16px 40px;
    margin: 0 -20px 32px;
    background: linear-gradient(160deg, var(--color-primary-light) 0%, #f7f8f7 70%);
    border-bottom: 1px solid var(--color-border);
}

.hero__eyebrow {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 999px;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 0.02em;
    margin-bottom: 16px;
}

.hero h1 {
    font-size: 1.6rem;
    line-height: 1.5;
    margin: 0 0 12px;
    color: var(--color-primary-dark);
}

.hero__lead {
    max-width: 480px;
    margin: 0 auto 20px;
    color: #444;
    font-size: 0.95rem;
}

.trust-badges {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 0;
    margin: 0 0 24px;
}

.trust-badges li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: bold;
    color: var(--color-primary-dark);
    box-shadow: var(--shadow-sm);
}

.trust-badges__icon {
    font-size: 0.85rem;
}

.btn-hero {
    padding: 16px 36px;
    font-size: 1.1rem;
    box-shadow: var(--shadow-md);
}

.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 28px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.card--primary {
    border: 2px solid var(--color-primary);
    scroll-margin-top: 16px;
}

.section-heading {
    text-align: center;
    margin-bottom: 24px;
}

.section-heading__eyebrow {
    display: block;
    font-size: 0.78rem;
    font-weight: bold;
    color: var(--color-accent-dark);
    letter-spacing: 0.03em;
    margin-bottom: 6px;
}

.section-heading h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
    color: var(--color-primary-dark);
}

.section-heading__desc {
    margin: 0 auto;
    max-width: 460px;
    font-size: 0.88rem;
    color: #666;
}

.form-row--step label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.note--center {
    text-align: center;
}

.btn-lg {
    padding: 16px 40px;
    font-size: 1.1rem;
}

.benefits {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.benefits__item {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 20px 14px;
    text-align: center;
}

.benefits__icon {
    display: inline-block;
    font-size: 1.6rem;
    margin-bottom: 10px;
}

.benefits__item h3 {
    font-size: 0.92rem;
    margin: 0 0 6px;
    color: var(--color-primary-dark);
}

.benefits__item p {
    font-size: 0.78rem;
    color: #666;
    margin: 0;
    line-height: 1.6;
}

@media (max-width: 600px) {
    .benefits {
        grid-template-columns: 1fr;
    }
}

.form-row {
    margin-bottom: 18px;
}

.form-row label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
}

.form-row .required {
    color: var(--color-error);
    font-size: 0.8rem;
    margin-left: 4px;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="tel"],
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

.errors {
    background: #fdecea;
    border: 1px solid var(--color-error);
    color: var(--color-error);
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.btn {
    display: inline-block;
    padding: 14px 28px;
    border-radius: 6px;
    border: none;
    background: #e07b00;
    color: #fff;
    font-size: 1.05rem;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn:hover { background: #c96a00; }

.btn-secondary {
    background: #fff;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-secondary:hover { background: #f0f5f2; }

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

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

table.confirm-table th,
table.confirm-table td {
    border-bottom: 1px solid var(--color-border);
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}

table.confirm-table th {
    width: 40%;
    color: #555;
    font-weight: normal;
}

.complete-box {
    text-align: center;
}

.assessment-no {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--color-primary);
}

.steps-after {
    list-style: none;
    padding: 0;
    counter-reset: step;
}

.steps-after li {
    counter-increment: step;
    position: relative;
    padding: 8px 8px 8px 40px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

.steps-after li::before {
    content: "STEP" counter(step);
    position: absolute;
    left: 8px;
    top: 8px;
    font-size: 0.7rem;
    color: var(--color-primary);
    font-weight: bold;
}

.site-footer {
    text-align: center;
    padding: 24px;
    font-size: 0.85rem;
    color: #777;
}

.note {
    font-size: 0.85rem;
    color: #666;
}

/* ===== チャット（LINE風） =====
   1発言 = .chat-row。左＝相手（丸アイコン＋名前＋白い吹き出し）、右＝自分（緑の吹き出し、アイコン・名前なし）。
   吹き出しにはしっぽを付け、時刻（と既読・送信中）は吹き出しの外側の下に小さく出す。日付が変わる所に日付の区切り。 */
.chat-window {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: min(70vh, 640px);
    overflow-y: auto;
    padding: 16px 14px;
    margin: 12px 0;
    background: #a9c1e6;
    border-radius: 12px;
}

.chat-date {
    align-self: center;
    padding: 3px 14px;
    border-radius: 999px;
    background: rgba(29, 45, 74, 0.35);
    color: #fff;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

.chat-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.chat-row--right {
    justify-content: flex-end;
}

.chat-avatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: #fff;
}

.chat-avatar--ai { background: #ffffff; }
.chat-avatar--staff { background: #ffe2b8; box-shadow: 0 0 0 2px var(--color-accent); }
.chat-avatar--user { background: #dff3d6; }

.chat-row__body {
    display: flex;
    flex-direction: column;
    max-width: 76%;
    min-width: 0;
}

.chat-row--right .chat-row__body {
    align-items: flex-end;
}

.chat-row__name {
    margin: 0 0 4px 6px;
    font-size: 0.78rem;
    font-weight: bold;
    color: #22324d;
}

.chat-row--right .chat-row__name {
    margin: 0 6px 4px 0;
}

.chat-row__line {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.chat-row--right .chat-row__line {
    flex-direction: row-reverse;
}

.chat-row__meta {
    flex: 0 0 auto;
    font-size: 0.68rem;
    line-height: 1.35;
    color: #2f4060;
    white-space: nowrap;
}

.chat-row--right .chat-row__meta {
    text-align: right;
}

.chat-row__status:empty {
    display: none;
}

.chat-row__status--sending {
    font-weight: bold;
}

.chat-bubble {
    position: relative;
    padding: 9px 14px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    background: #fff;
    color: #1d1d1d;
}

/* 吹き出しのしっぽ（相手は左上、自分は右上） */
.chat-row--left .chat-bubble::before,
.chat-row--right .chat-bubble::before {
    content: "";
    position: absolute;
    top: 12px;
    border-style: solid;
}

.chat-row--left .chat-bubble::before {
    left: -7px;
    border-width: 6px 9px 6px 0;
    border-color: transparent var(--bubble-bg, #fff) transparent transparent;
}

.chat-row--right .chat-bubble::before {
    right: -7px;
    border-width: 6px 0 6px 9px;
    border-color: transparent transparent transparent var(--bubble-bg, #8de055);
}

.chat-bubble--user { --bubble-bg: #8de055; background: #8de055; }
.chat-bubble--assistant { --bubble-bg: #fff; background: #fff; }
/* 人間の担当者・専門家の発言（AIの白い吹き出しと区別する） */
.chat-bubble--staff { --bubble-bg: #ffe9c7; background: #ffe9c7; box-shadow: inset 0 0 0 1.5px var(--color-accent); }

/* 送信中・入力中の表示 */
.chat-row--pending .chat-bubble { opacity: 0.55; }

.chat-typing {
    display: inline-flex;
    gap: 4px;
    padding: 5px 2px;
}

.chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9aa5b1;
    animation: chat-typing-bounce 1.2s infinite ease-in-out;
}

.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes chat-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 480px) {
    .chat-window { padding: 12px 10px; }
    .chat-avatar { flex-basis: 34px; width: 34px; height: 34px; font-size: 1.1rem; }
    .chat-row__body { max-width: 80%; }
    .chat-bubble { font-size: 0.92rem; }
}

.chat-form {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.chat-form textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
}

.chat-error {
    color: var(--color-error);
    margin-top: 8px;
}

.chat-cta {
    align-self: stretch;
    background: var(--color-primary-light);
    border: 1px solid var(--color-primary);
    border-radius: 10px;
    padding: 12px 14px;
    text-align: center;
}

.chat-cta__text {
    margin: 0 0 10px;
    font-size: 0.85rem;
    color: var(--color-primary-dark);
    font-weight: bold;
}

.chat-cta__btn {
    padding: 10px 20px;
    font-size: 0.9rem;
}

.card--highlight {
    animation: card-highlight-pulse 1.6s ease-out;
}

@keyframes card-highlight-pulse {
    0% { box-shadow: 0 0 0 4px rgba(27, 110, 79, 0.35); }
    100% { box-shadow: var(--shadow-sm); }
}

/* 悩み相談ポータル */

.consultation-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0 24px;
}

.consultation-card {
    display: block;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 16px 18px;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
}

.consultation-card:hover {
    border-color: var(--color-primary);
}

.consultation-card__head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.consultation-card__category {
    font-weight: bold;
}

.consultation-card__meta {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: bold;
}

.status-badge--open {
    background: #fdecea;
    color: var(--color-error);
}

.status-badge--answered {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
}

.status-badge--closed {
    background: #eee;
    color: #666;
}

.status-badge--received {
    background: #fdecea;
    color: var(--color-error);
}

.status-badge--company_notified {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
}

.status-badge--failed {
    background: var(--color-error);
    color: #fff;
}

.debug-box {
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px dashed var(--color-accent);
    border-radius: 8px;
    background: #fff8ef;
    text-align: center;
}

.debug-box__label {
    margin: 0 0 8px;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--color-accent-dark);
}

/* 管理画面：AI振り分け分析 */
.routing-targets {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.routing-target {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 14px 12px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-card);
}

.routing-target--selected {
    border: 2px solid var(--color-primary);
    background: var(--color-primary-light);
}

.routing-target--dimmed {
    opacity: 0.55;
}

.routing-target__badge {
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: bold;
}

.routing-target__name {
    font-size: 1.05rem;
    font-weight: bold;
    color: var(--color-primary-dark);
}

.routing-target__note {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.5;
}

.routing-confidence {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-bottom: 12px;
}

.routing-confidence__label {
    font-size: 0.85rem;
    color: #666;
}

.routing-confidence__meter {
    display: inline-flex;
    gap: 3px;
}

.routing-confidence__meter span {
    width: 22px;
    height: 8px;
    border-radius: 2px;
    background: var(--color-border);
}

.routing-confidence--high .is-on { background: var(--color-primary); }
.routing-confidence--medium .is-on { background: var(--color-accent); }
.routing-confidence--low .is-on { background: var(--color-error); }

.routing-confidence__hint {
    flex-basis: 100%;
    font-size: 0.8rem;
    color: var(--color-accent-dark);
}

.routing-reason {
    margin-bottom: 12px;
    padding: 12px 14px;
    border-left: 4px solid var(--color-primary);
    border-radius: 0 8px 8px 0;
    background: var(--color-bg);
}

.routing-reason__label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.78rem;
    font-weight: bold;
    color: var(--color-primary-dark);
}

.routing-reason p {
    margin: 0;
    line-height: 1.7;
}

@media (max-width: 600px) {
    .routing-targets {
        grid-template-columns: 1fr;
    }
}

/* TOP：ご利用の流れ（STEP 1〜3） */
.benefits--flow .benefits__item {
    display: block;
    color: inherit;
    text-decoration: none;
}

.benefits--flow a.benefits__item:hover {
    border-color: var(--color-primary);
}

.benefits__step {
    display: block;
    margin-bottom: 4px;
    font-size: 0.72rem;
    font-weight: bold;
    color: var(--color-accent-dark);
    letter-spacing: 0.05em;
}

.chat-widget {
    scroll-margin-top: 16px;
}

/* マイページ：新しく申し込む（相談・査定） */
.mypage-actions__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.mypage-action {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
}

.mypage-action:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.mypage-action__icon {
    font-size: 1.4rem;
}

.mypage-action strong {
    color: var(--color-primary-dark);
}

.mypage-action span:last-child {
    font-size: 0.82rem;
    color: #666;
    line-height: 1.6;
}

@media (max-width: 600px) {
    .mypage-actions__grid {
        grid-template-columns: 1fr;
    }
}

/* ヘッダー：ヘルプ・マイページ */
.site-header__actions {
    display: inline-flex;
    gap: 8px;
}

.site-header__help {
    background: transparent;
    font-family: inherit;
    cursor: pointer;
}

/* 使い方ガイド（オンボーディング）：TOPの操作部分をスポットライトで強調しながら説明する */
.tour-spotlight {
    position: absolute;
    z-index: 1000;
    border-radius: 12px;
    box-shadow: 0 0 0 4px var(--color-accent), 0 0 0 9999px rgba(0, 0, 0, 0.55);
    pointer-events: none;
}

.tour-spotlight--none {
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
}

.tour-card {
    position: absolute;
    z-index: 1001;
    width: min(400px, calc(100vw - 32px));
    padding: 20px 20px 16px;
    border-radius: 14px;
    background: var(--color-card);
    color: var(--color-text);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.tour-card--fixed {
    position: fixed;
}

.tour-card__close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: none;
    background: none;
    font-size: 1.3rem;
    line-height: 1;
    color: #888;
    cursor: pointer;
}

.tour-card__eyebrow {
    display: block;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--color-accent-dark);
    letter-spacing: 0.05em;
}

.tour-card h2 {
    margin: 4px 0 8px;
    font-size: 1.05rem;
    color: var(--color-primary-dark);
}

.tour-card p {
    margin: 0 0 14px;
    font-size: 0.88rem;
    line-height: 1.75;
}

.tour-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tour-card__count {
    font-size: 0.8rem;
    color: #888;
}

.tour-card__foot .btn {
    padding: 8px 16px;
    font-size: 0.88rem;
}
