:root {
    --contact-yellow: #ffcf21;
    --contact-yellow-deep: #d9a900;
    --contact-black: #24221f;
    --contact-text: #2b2925;
    --contact-muted: #746f65;
    --contact-line: #ddd6c8;
    --contact-bg: #f3efe4;
    --contact-panel: #ffffff;
    --contact-danger: #b83e37;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-width: 320px;
    margin: 0;
    overflow-x: hidden;
}

body.contact-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 91% 5%, rgba(255, 207, 33, 0.30), transparent 22rem),
        var(--contact-bg);
    color: var(--contact-text);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Hiragino Kaku Gothic ProN",
        "Hiragino Sans",
        "Yu Gothic",
        Meiryo,
        sans-serif;
}

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

a {
    color: inherit;
}

.contact-header {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 10px clamp(18px, 4vw, 56px);
    background: var(--contact-black);
    color: #ffffff;
}

.contact-brand {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
}

.contact-brand img {
    display: block;
    width: auto;
    height: 48px;
    max-width: min(48vw, 280px);
    object-fit: contain;
}

.contact-header-links {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.contact-header-links a {
    color: rgba(255, 255, 255, 0.84);
    font-size: 13px;
    font-weight: 750;
    text-decoration: none;
}

.contact-header-links a:hover {
    color: var(--contact-yellow);
}

.contact-hero {
    background:
        linear-gradient(110deg, rgba(255, 207, 33, 0.08), transparent 55%),
        var(--contact-black);
    color: #ffffff;
}

.contact-hero-inner {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
    padding: clamp(58px, 8vw, 96px) 0 clamp(52px, 7vw, 82px);
}

.contact-kicker {
    margin: 0 0 9px;
    color: #b58b00;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.18em;
}

.contact-hero .contact-kicker {
    color: var(--contact-yellow);
}

.contact-hero h1 {
    margin: 0;
    font-size: clamp(38px, 7vw, 72px);
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.contact-hero p:not(.contact-kicker) {
    max-width: 680px;
    margin: 23px 0 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: clamp(14px, 1.8vw, 17px);
    line-height: 1.9;
}

.contact-zebra {
    height: 22px;
    background:
        repeating-linear-gradient(-45deg,
            var(--contact-yellow) 0,
            var(--contact-yellow) 22px,
            var(--contact-black) 22px,
            var(--contact-black) 44px);
}

.contact-layout {
    width: min(1180px, calc(100% - 40px));
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
    margin: clamp(32px, 5vw, 62px) auto 72px;
}

.contact-guide {
    display: grid;
    gap: 16px;
    position: sticky;
    top: 18px;
}

.contact-guide-card,
.contact-account-card,
.contact-form-card {
    border: 1px solid var(--contact-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 48px rgba(62, 50, 29, 0.09);
}

.contact-guide-card {
    padding: 23px;
}

.contact-guide-label,
.contact-account-card>span {
    display: block;
    margin-bottom: 8px;
    color: #9a7800;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.13em;
}

.contact-guide-card h2 {
    margin: 0;
    font-size: 18px;
}

.contact-guide-card ul {
    display: grid;
    gap: 10px;
    margin: 18px 0;
    padding-left: 1.25em;
    color: var(--contact-muted);
    font-size: 13px;
    line-height: 1.7;
}

.contact-guide-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    border-radius: 9px;
    background: var(--contact-black);
    color: #ffffff;
    font-size: 13px;
    font-weight: 850;
    text-decoration: none;
}

.contact-guide-link:hover {
    background: #000000;
    color: var(--contact-yellow);
}

.contact-account-card {
    padding: 20px 22px;
    background:
        linear-gradient(145deg, rgba(255, 207, 33, 0.25), rgba(255, 255, 255, 0.95) 62%);
}

.contact-account-card strong {
    display: block;
    font-size: 15px;
}

.contact-account-card p {
    margin: 8px 0 0;
    color: var(--contact-muted);
    font-size: 12px;
    line-height: 1.65;
}

.contact-form-card {
    min-width: 0;
    padding: clamp(22px, 4vw, 42px);
}

.contact-form-heading {
    padding-bottom: 24px;
    border-bottom: 1px solid var(--contact-line);
}

.contact-form-heading h2 {
    margin: 0;
    font-size: clamp(24px, 3.5vw, 34px);
}

.contact-form-heading p:not(.contact-kicker) {
    margin: 9px 0 0;
    color: var(--contact-muted);
    font-size: 13px;
}

#contactForm {
    margin-top: 28px;
}

.contact-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.contact-field {
    min-width: 0;
    display: grid;
    gap: 8px;
}

.contact-field-wide {
    grid-column: 1 / -1;
}

.contact-field>span {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 850;
}

.contact-field>span b {
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--contact-yellow);
    color: var(--contact-black);
    font-size: 9px;
}

.contact-field input,
.contact-field select,
.contact-field textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid #cfc7b9;
    border-radius: 10px;
    background: #fffefa;
    color: var(--contact-text);
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.contact-field input,
.contact-field select {
    min-height: 48px;
    padding: 10px 13px;
}

.contact-field textarea {
    min-height: 220px;
    padding: 13px;
    resize: vertical;
    line-height: 1.75;
}

.contact-field input:focus,
.contact-field select:focus,
.contact-field textarea:focus {
    border-color: var(--contact-yellow-deep);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(255, 207, 33, 0.20);
}

.contact-field small {
    justify-self: end;
    color: var(--contact-muted);
    font-size: 11px;
}

.contact-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.contact-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 22px;
    color: var(--contact-muted);
    font-size: 13px;
    line-height: 1.6;
}

.contact-consent input {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: var(--contact-yellow-deep);
}

.contact-consent a {
    font-weight: 800;
}

.contact-submit-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 26px;
}

#contactSubmitButton,
#contactResetButton {
    min-height: 50px;
    border: 0;
    border-radius: 10px;
    padding: 12px 22px;
    background: var(--contact-yellow);
    color: var(--contact-black);
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(190, 145, 0, 0.18);
}

#contactSubmitButton:hover,
#contactResetButton:hover {
    background: #ffdc55;
}

#contactSubmitButton:disabled {
    cursor: wait;
    opacity: 0.65;
}

#contactFormMessage {
    min-width: 0;
    margin: 0;
    color: var(--contact-muted);
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

#contactFormMessage[data-tone="error"] {
    color: var(--contact-danger);
    font-weight: 800;
}

.contact-success {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    margin-top: 28px;
    padding: clamp(22px, 4vw, 34px);
    border: 1px solid #d9c77a;
    border-radius: 15px;
    background: linear-gradient(145deg, #fff7cd, #ffffff 72%);
}

.contact-success[hidden] {
    display: none;
}

.contact-success-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--contact-black);
    color: var(--contact-yellow);
    font-size: 24px;
    font-weight: 900;
}

.contact-success h2 {
    margin: 0;
    font-size: 24px;
}

.contact-success p:not(.contact-kicker) {
    margin: 10px 0;
    color: var(--contact-muted);
    line-height: 1.7;
}

.contact-success strong {
    color: var(--contact-black);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

#contactResetButton {
    min-height: 42px;
    margin-top: 8px;
    padding: 9px 15px;
    background: var(--contact-black);
    color: #ffffff;
    box-shadow: none;
}

.contact-footer {
    border-top: 1px solid rgba(36, 34, 31, 0.14);
    background: #ffffff;
}

.contact-footer>div {
    width: min(1180px, calc(100% - 40px));
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 0 auto;
    color: var(--contact-muted);
    font-size: 12px;
}

.contact-footer nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 18px;
}

.contact-footer a {
    text-decoration: none;
}

.contact-footer a:hover {
    color: var(--contact-black);
    text-decoration: underline;
}

@media (max-width: 860px) {
    .contact-layout {
        grid-template-columns: 1fr;
    }

    .contact-guide {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .contact-header {
        min-height: auto;
        align-items: flex-start;
        padding: 12px 15px;
    }

    .contact-brand img {
        height: 34px;
        max-width: 42vw;
    }

    .contact-header-links {
        flex: 1;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 16px;
        overflow-x: auto;
        padding: 7px 1px 8px;
        scrollbar-width: thin;
    }

    .contact-header-links a {
        flex: 0 0 auto;
        font-size: 11px;
    }

    .contact-hero-inner,
    .contact-layout,
    .contact-footer>div {
        width: min(100% - 28px, 1180px);
    }

    .contact-hero-inner {
        padding-top: 46px;
        padding-bottom: 50px;
    }

    .contact-zebra {
        height: 16px;
        background-size: auto;
    }

    .contact-guide {
        grid-template-columns: 1fr;
    }

    .contact-form-card {
        padding: 21px 16px 24px;
        border-radius: 14px;
    }

    .contact-field-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .contact-field-wide {
        grid-column: auto;
    }

    .contact-submit-row {
        align-items: stretch;
        flex-direction: column;
    }

    #contactSubmitButton {
        width: 100%;
    }

    .contact-success {
        grid-template-columns: 1fr;
    }

    .contact-footer>div {
        align-items: flex-start;
        flex-direction: column;
        padding: 24px 0;
    }

    .contact-footer nav {
        justify-content: flex-start;
    }
}

@media (max-width: 380px) {
    .contact-header {
        gap: 10px;
    }

    .contact-brand img {
        height: 29px;
    }

    .contact-hero h1 {
        font-size: 38px;
    }
}

/* ========================================
 * お問い合わせ履歴・添付ファイル
 * ======================================== */

.contact-workspace {
    min-width: 0;
}

.contact-view-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding: 7px;
    border: 1px solid var(--contact-line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 32px rgba(62, 50, 29, 0.06);
}

.contact-view-tab {
    min-width: 0;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 0;
    padding: 10px 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--contact-muted);
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
}

.contact-view-tab:hover {
    background: #f7f3e9;
    color: var(--contact-black);
}

.contact-view-tab.is-active {
    background: var(--contact-black);
    color: var(--contact-yellow);
}

.contact-tab-badge {
    min-width: 22px;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--contact-danger);
    color: #fff;
    font-size: 10px;
    line-height: 1.5;
}

.contact-account-link {
    display: inline-flex;
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--contact-black);
    color: #fff;
    font-size: 12px;
    font-weight: 850;
    text-decoration: none;
}

.contact-file-picker {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 17px;
    border: 1px dashed #b7aa91;
    border-radius: 11px;
    background: #fbf8f0;
    cursor: pointer;
    transition: border-color .16s ease, background-color .16s ease;
}

.contact-file-picker:hover {
    border-color: var(--contact-yellow-deep);
    background: #fff7ce;
}

.contact-file-picker strong {
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--contact-black);
    color: #fff;
    font-size: 12px;
}

.contact-file-picker small {
    justify-self: auto;
    color: var(--contact-muted);
    text-align: right;
    line-height: 1.6;
}

.contact-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.contact-attachment-list {
    display: grid;
    gap: 7px;
}

.contact-selected-file {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 9px;
    align-items: center;
    padding: 10px 11px;
    border: 1px solid var(--contact-line);
    border-radius: 9px;
    background: #fff;
}

.contact-selected-file-icon {
    min-width: 40px;
    padding: 5px 6px;
    border-radius: 6px;
    background: var(--contact-yellow);
    color: var(--contact-black);
    font-size: 9px;
    font-weight: 950;
    text-align: center;
}

.contact-selected-file-name {
    min-width: 0;
    overflow: hidden;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-selected-file-size {
    color: var(--contact-muted);
    font-size: 11px;
}

.contact-selected-file button {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: #f0ece3;
    color: var(--contact-muted);
    cursor: pointer;
}

.contact-file-message {
    min-height: 1.4em;
    margin: 0;
    color: var(--contact-muted);
    font-size: 11px;
}

.contact-file-message[data-tone="error"] {
    color: var(--contact-danger);
    font-weight: 800;
}

.contact-success-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    align-items: center;
    margin-top: 12px;
}

#contactOpenHistoryButton {
    min-height: 42px;
    padding: 9px 15px;
    border: 0;
    border-radius: 9px;
    background: var(--contact-yellow);
    color: var(--contact-black);
    font-weight: 900;
    cursor: pointer;
}

.contact-history-card {
    min-width: 0;
    padding: clamp(22px, 4vw, 34px);
    border: 1px solid var(--contact-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 48px rgba(62, 50, 29, 0.09);
}

.contact-history-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.contact-small-button {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid var(--contact-line);
    border-radius: 8px;
    background: #fff;
    color: var(--contact-text);
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}

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

.contact-history-login {
    margin-top: 24px;
    padding: 26px;
    border: 1px solid #d9c77a;
    border-radius: 14px;
    background: linear-gradient(145deg, #fff7cd, #fff 75%);
}

.contact-history-login h3 {
    margin: 0;
}

.contact-history-login p {
    color: var(--contact-muted);
    line-height: 1.7;
}

.contact-history-login a {
    display: inline-flex;
    padding: 10px 15px;
    border-radius: 8px;
    background: var(--contact-black);
    color: #fff;
    font-size: 13px;
    font-weight: 850;
    text-decoration: none;
}

.contact-history-workspace {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(230px, 310px) minmax(0, 1fr);
    gap: 14px;
    margin-top: 22px;
}

.contact-history-list-wrap,
.contact-history-detail {
    min-width: 0;
    border: 1px solid var(--contact-line);
    border-radius: 13px;
    background: #fff;
}

.contact-history-list-wrap {
    overflow: hidden;
}

.contact-history-message {
    min-height: 1.4em;
    margin: 0;
    padding: 12px 13px 0;
    color: var(--contact-muted);
    font-size: 11px;
}

.contact-history-list {
    max-height: 720px;
    overflow-y: auto;
    padding: 9px;
}

.contact-history-row {
    width: 100%;
    min-width: 0;
    display: grid;
    gap: 8px;
    margin-bottom: 8px;
    padding: 13px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #f8f5ee;
    color: var(--contact-text);
    text-align: left;
    cursor: pointer;
}

.contact-history-row:hover,
.contact-history-row.is-active {
    border-color: #c8ad45;
    background: #fff8d9;
}

.contact-history-row.has-unread {
    box-shadow: inset 4px 0 0 var(--contact-yellow-deep);
}

.contact-history-row-top,
.contact-history-detail-head,
.contact-message-head,
.contact-reply-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.contact-history-code {
    color: #8f6e00;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    font-weight: 900;
}

.contact-history-unread {
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--contact-danger);
    color: #fff;
    font-size: 9px;
    font-weight: 900;
}

.contact-history-row>strong {
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-history-row p {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--contact-muted);
    font-size: 11px;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.contact-history-row time {
    color: #948c7f;
    font-size: 10px;
}

.contact-history-row-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.contact-history-badge {
    padding: 3px 7px;
    border-radius: 999px;
    background: #ece8df;
    color: #635d53;
    font-size: 9px;
    font-weight: 850;
}

.contact-history-badge--status[data-value="new"],
.contact-history-badge--status[data-value="open"] {
    background: #fff0c4;
    color: #835f00;
}

.contact-history-badge--status[data-value="in_progress"] {
    background: #dfeeff;
    color: #245c91;
}

.contact-history-badge--status[data-value="waiting_user"] {
    background: #eee5ff;
    color: #65419b;
}

.contact-history-badge--status[data-value="resolved"] {
    background: #dff4e6;
    color: #267246;
}

.contact-history-empty-list,
.contact-history-empty {
    padding: 30px 18px;
    color: var(--contact-muted);
    text-align: center;
}

.contact-history-empty strong {
    display: block;
    color: var(--contact-text);
}

.contact-history-detail {
    overflow: hidden;
}

.contact-history-detail-head {
    padding: 19px 20px;
    border-bottom: 1px solid var(--contact-line);
    background: #fbf8f0;
}

.contact-history-detail-head h3 {
    margin: 6px 0 0;
    font-size: 18px;
}

.contact-history-detail-head p {
    margin: 7px 0 0;
    color: var(--contact-muted);
    font-size: 11px;
}

.contact-message-timeline {
    display: grid;
    gap: 13px;
    padding: 20px;
    background: #f7f3e9;
}

.contact-message {
    width: min(88%, 680px);
    padding: 15px 17px;
    border: 1px solid var(--contact-line);
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(62, 50, 29, .05);
}

.contact-message.is-user {
    justify-self: end;
    border-bottom-right-radius: 4px;
}

.contact-message.is-admin {
    justify-self: start;
    border-left: 5px solid var(--contact-yellow);
    border-bottom-left-radius: 4px;
}

.contact-message-head strong {
    font-size: 12px;
}

.contact-message-head time {
    color: var(--contact-muted);
    font-size: 10px;
}

.contact-message-body {
    margin-top: 10px;
    overflow-wrap: anywhere;
    font-size: 13px;
    line-height: 1.75;
}

.contact-message-attachments {
    display: grid;
    gap: 7px;
    margin-top: 13px;
}

.contact-attachment-download {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 9px 10px;
    border: 1px solid var(--contact-line);
    border-radius: 8px;
    background: #fbfaf6;
    color: var(--contact-text);
    text-align: left;
    cursor: pointer;
}

.contact-attachment-download>span {
    min-width: 38px;
    padding: 4px;
    border-radius: 5px;
    background: var(--contact-yellow);
    font-size: 8px;
    font-weight: 950;
    text-align: center;
}

.contact-attachment-download strong {
    min-width: 0;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-attachment-download small {
    color: var(--contact-muted);
    font-size: 9px;
}

.contact-reply-box {
    padding: 20px;
    border-top: 1px solid var(--contact-line);
    background: #fff;
}

.contact-reply-heading h4 {
    margin: 0;
    font-size: 16px;
}

.contact-reply-heading p {
    margin: 0;
    color: var(--contact-muted);
    font-size: 11px;
}

.contact-reply-box .contact-field {
    margin-top: 15px;
}

.contact-reply-box textarea {
    min-height: 130px;
}

.contact-reply-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 15px;
}

#contactHistoryReplyButton {
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 9px;
    background: var(--contact-yellow);
    color: var(--contact-black);
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

#contactHistoryReplyButton:disabled {
    opacity: .55;
    cursor: wait;
}

#contactHistoryReplyMessageStatus {
    margin: 0;
    color: var(--contact-muted);
    font-size: 11px;
}

#contactHistoryReplyMessageStatus[data-tone="error"] {
    color: var(--contact-danger);
    font-weight: 800;
}

#contactHistoryReplyMessageStatus[data-tone="success"] {
    color: #267246;
    font-weight: 800;
}

@media (max-width: 1060px) {
    .contact-history-workspace {
        grid-template-columns: 1fr;
    }

    .contact-history-list {
        max-height: 360px;
    }
}

@media (max-width: 680px) {
    .contact-view-tabs {
        padding: 5px;
    }

    .contact-view-tab {
        min-height: 43px;
        padding: 8px;
        font-size: 11px;
    }

    .contact-file-picker,
    .contact-history-heading,
    .contact-history-detail-head,
    .contact-reply-heading,
    .contact-reply-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .contact-file-picker small {
        text-align: left;
    }

    .contact-selected-file {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .contact-selected-file-size {
        display: none;
    }

    .contact-history-card {
        padding: 18px 12px;
        border-radius: 14px;
    }

    .contact-history-workspace {
        margin-top: 16px;
    }

    .contact-message {
        width: 96%;
    }

    .contact-message-timeline,
    .contact-reply-box {
        padding: 14px;
    }

    .contact-success-actions>button {
        width: 100%;
    }
}


/* =========================================================
   CONTACT ATTACHMENT IMAGE PREVIEW
========================================================= */
.contact-attachment-image {
    width: min(100%, 340px);
    min-width: 0;
    display: grid;
    gap: 8px;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--contact-line);
    border-radius: 10px;
    background: #fbfaf6;
    color: var(--contact-text);
    text-align: left;
    cursor: zoom-in;
    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.contact-attachment-image:hover {
    transform: translateY(-1px);
    border-color: #b99e3b;
    box-shadow: 0 9px 22px rgba(68, 54, 25, .10);
}

.contact-attachment-image-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(255, 207, 33, .22), transparent 45%),
        #eeeae1;
}

.contact-attachment-image-frame img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.contact-attachment-image-status {
    padding: 8px 12px;
    color: var(--contact-muted);
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
    text-align: center;
}

.contact-attachment-image.is-ready .contact-attachment-image-status {
    display: none;
}

.contact-attachment-image-meta {
    min-width: 0;
    display: grid;
    gap: 3px;
    padding: 2px 11px 11px;
}

.contact-attachment-image-meta strong {
    min-width: 0;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-attachment-image-meta small {
    color: var(--contact-muted);
    font-size: 9px;
}

body.contact-image-preview-open {
    overflow: hidden;
}

.contact-image-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(18, 17, 14, .84);
    backdrop-filter: blur(5px);
}

.contact-image-preview-modal.is-open {
    display: flex;
}

.contact-image-preview-card {
    width: min(100%, 1120px);
    max-height: min(92vh, 920px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 16px;
    background: #1e1d1a;
    box-shadow: 0 28px 70px rgba(0, 0, 0, .42);
}

.contact-image-preview-card>header,
.contact-image-preview-card>footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 18px;
    background: #fff;
}

.contact-image-preview-card>header h2 {
    margin: 0;
    font-size: 18px;
}

.contact-image-preview-close {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 50%;
    background: #eeeae1;
    color: var(--contact-text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.contact-image-preview-stage {
    min-height: 260px;
    display: grid;
    place-items: center;
    overflow: auto;
    padding: 18px;
    background:
        linear-gradient(45deg, #282724 25%, transparent 25%),
        linear-gradient(-45deg, #282724 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #282724 75%),
        linear-gradient(-45deg, transparent 75%, #282724 75%),
        #22211e;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
}

.contact-image-preview-stage img {
    max-width: 100%;
    max-height: calc(92vh - 170px);
    display: block;
    object-fit: contain;
    box-shadow: 0 10px 35px rgba(0, 0, 0, .28);
}

.contact-image-preview-loading {
    margin: 0;
    color: rgba(255, 255, 255, .84);
    font-size: 13px;
    font-weight: 800;
}

.contact-image-preview-card>footer>div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.contact-image-preview-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-image-preview-size {
    color: var(--contact-muted);
}

.contact-image-preview-save {
    min-height: 40px;
    flex: 0 0 auto;
    padding: 9px 14px;
    border: 1px solid var(--contact-line);
    border-radius: 8px;
    background: #fff;
    color: var(--contact-text);
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
}

.contact-image-preview-save:disabled {
    opacity: .5;
    cursor: wait;
}

@media (max-width: 680px) {
    .contact-image-preview-modal {
        padding: 8px;
    }

    .contact-image-preview-card {
        max-height: 96vh;
        border-radius: 12px;
    }

    .contact-image-preview-card>header,
    .contact-image-preview-card>footer {
        padding: 12px;
    }

    .contact-image-preview-card>footer {
        align-items: stretch;
        flex-direction: column;
    }

    .contact-image-preview-save {
        width: 100%;
    }

    .contact-image-preview-stage {
        min-height: 220px;
        padding: 8px;
    }

    .contact-image-preview-stage img {
        max-height: calc(96vh - 210px);
    }
}