/* =====================================================================
   Seller support center (/panel/submit-ticket).
   Inbox + conversation, like a mail / chat app. Neutral surfaces, the brand
   color only for the primary action, the active item and the seller's bubbles.
   Uses the --jp-* tokens of app-theme.css (with fallbacks). RTL, light + dark.
   ===================================================================== */

.jt {
    --jt-surface: var(--jp-surface, #fff);
    --jt-soft: var(--jp-soft, #F5F5F5);
    --jt-bg: var(--jp-bg, #FAFAFA);
    --jt-border: var(--jp-border, #E5E5E5);
    --jt-border-strong: var(--jp-border-strong, #D4D4D4);
    --jt-text: var(--jp-text, #262626);
    --jt-text-2: var(--jp-text-2, #525252);
    --jt-muted: var(--jp-muted, #737373);
    --jt-action: var(--jp-action, #007F3E);
    --jt-action-hover: var(--jp-action-hover, #006B34);
    --jt-brand: var(--jp-brand, #00A651);
    --jt-brand-soft: var(--jp-brand-soft, #E8F6EE);
    --jt-ring: rgba(0, 127, 62, .22);
    --jt-danger: var(--jp-danger, #DC2626);
    --jt-radius: 14px;
    --jt-radius-sm: 10px;
    --jt-ease: cubic-bezier(.2, .7, .2, 1);
    /* Two-pane height on desktop, so the page itself never scrolls: viewport minus
       topbar 64 + main padding 28/56 + our header ~56 + gap 20 + footer ~51 (≈ 275) */
    --jt-shell-h: calc(100dvh - 280px);

    display: flex;
    flex-direction: column;
    gap: 20px;
    color: var(--jt-text);
}

.jt [x-cloak] { display: none !important; }

/* Filament's empty page header still adds 2 × 32px of padding: drop it on this page */
.fi-page:has(.jt) .fi-page-header-main-ctn {
    padding-block: 0;
    gap: 0;
}

/* ---------------- Page header ---------------- */

.jt-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.jt-h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.01em;
}

.jt-lead {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--jt-muted);
}

.jt-h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.6;
}

.jt-sub {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--jt-muted);
}

/* ---------------- Buttons ---------------- */

.jt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding-inline: 18px;
    border: 1px solid transparent;
    border-radius: var(--jt-radius-sm);
    font-size: 13.5px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s var(--jt-ease), border-color .15s var(--jt-ease), color .15s var(--jt-ease), transform .1s ease;
}

.jt-btn svg { width: 18px; height: 18px; }
.jt-btn:active { transform: scale(.985); }
.jt-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--jt-surface), 0 0 0 4px var(--jt-action); }
.jt-btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

.jt-btn--primary { background: var(--jt-action); color: #fff; }
.jt-btn--primary:hover:not([disabled]) { background: var(--jt-action-hover); }

.jt-btn--ghost { background: var(--jt-surface); border-color: var(--jt-border-strong); color: var(--jt-text); }
.jt-btn--ghost:hover { background: var(--jt-soft); }

.jt-btn--sm { min-height: 36px; padding-inline: 14px; font-size: 12.5px; }

.jt-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--jt-text-2);
    cursor: pointer;
}

.jt-icon-btn svg { width: 20px; height: 20px; }
.jt-icon-btn:hover { background: var(--jt-soft); color: var(--jt-text); }
.jt-icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--jt-action); }
.jt-icon-btn--sm { width: 32px; height: 32px; }
.jt-icon-btn--sm svg { width: 16px; height: 16px; }

/* ---------------- Two-pane shell ---------------- */

.jt-shell {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    height: max(440px, var(--jt-shell-h));
    border: 1px solid var(--jt-border);
    border-radius: var(--jt-radius);
    background: var(--jt-surface);
    overflow: hidden;
}

/* ---------------- Inbox ---------------- */

.jt-inbox {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-inline-end: 1px solid var(--jt-border);
}

.jt-inbox-tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid var(--jt-border);
}

.jt-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding-inline: 12px;
    border: 1px solid var(--jt-border-strong);
    border-radius: var(--jt-radius-sm);
    background: var(--jt-surface);
    color: var(--jt-muted);
    transition: border-color .15s var(--jt-ease), box-shadow .15s var(--jt-ease);
}

.jt-search:focus-within { border-color: var(--jt-action); box-shadow: 0 0 0 3px var(--jt-ring); }
.jt-search svg { width: 18px; height: 18px; flex-shrink: 0; }

.jt-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent;
    padding: 0;
    font-size: 13px;
    color: var(--jt-text);
}

.jt-search input::placeholder { color: var(--jt-muted); }

/* Segmented control */
.jt-seg {
    display: flex;
    padding: 3px;
    border: 1px solid var(--jt-border);
    border-radius: 11px;
    background: var(--jt-soft);
}

.jt-seg button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding-inline: 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--jt-muted);
    cursor: pointer;
    transition: background-color .15s var(--jt-ease), color .15s var(--jt-ease);
}

.jt-seg button:hover { color: var(--jt-text); }
.jt-seg button.is-on { background: var(--jt-surface); color: var(--jt-text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.jt-seg button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--jt-action); }

.jt-seg-n {
    min-width: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--jt-border);
    font-size: 11px;
    line-height: 18px;
    font-variant-numeric: tabular-nums;
}

.jt-seg button.is-on .jt-seg-n { background: var(--jt-brand-soft); color: var(--jt-action); }

.jt-seg--fit { display: inline-flex; }
.jt-seg--fit button { flex: none; min-width: 84px; }
.jt-seg button.is-on.is-medium { color: #B45309; }
.jt-seg button.is-on.is-high { color: #B91C1C; }

/* Ticket list */
.jt-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    transition: opacity .15s var(--jt-ease);
}

.jt-list.is-busy { opacity: .55; }

.jt-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    padding: 14px 16px;
    border: 0;
    border-bottom: 1px solid var(--jt-border);
    background: transparent;
    text-align: start;
    cursor: pointer;
    transition: background-color .12s var(--jt-ease);
}

.jt-item:hover { background: var(--jt-soft); }
.jt-item:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--jt-action); }

/* Active: soft brand tint + a bar on the start edge */
.jt-item.is-active { background: var(--jt-brand-soft); }
.jt-item.is-active::before {
    content: "";
    position: absolute;
    inset-block: 10px;
    inset-inline-start: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--jt-action);
}

.jt-item-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.jt-item-title {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--jt-text);
}

.jt-item.is-unread .jt-item-title { font-weight: 800; }
.jt-item.is-closed .jt-item-title { color: var(--jt-text-2); }

.jt-item-time {
    flex-shrink: 0;
    font-size: 11.5px;
    color: var(--jt-muted);
    font-variant-numeric: tabular-nums;
}

.jt-item.is-unread .jt-item-time { color: var(--jt-action); font-weight: 700; }

.jt-item-snippet {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 12.5px;
    color: var(--jt-muted);
}

.jt-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 11.5px;
    color: var(--jt-muted);
}

.jt-item-dep {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Status pill: neutral pill, colored dot (color comes from the admin's status settings) */
.jt-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 1px 9px 1px 10px;
    border: 1px solid var(--jt-border);
    border-radius: 999px;
    background: var(--jt-surface);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 20px;
    color: var(--jt-text-2);
}

.jt-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--c, #A3A3A3);
}

.jt-status--lg { padding-block: 4px; font-size: 12px; }

.jt-badge {
    margin-inline-start: auto;
    flex-shrink: 0;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--jt-action);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
}

.jt-list-empty {
    padding: 40px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--jt-muted);
}

.jt-more {
    display: block;
    width: 100%;
    min-height: 48px;
    border: 0;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--jt-action);
    cursor: pointer;
}

.jt-more:hover { background: var(--jt-soft); }

/* ---------------- Main pane ---------------- */

.jt-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--jt-bg);
}

.jt-pane-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--jt-border);
    background: var(--jt-surface);
}

/* Back button only where the inbox is hidden (phones) */
.jt-back { display: none; }

/* ---------------- Empty state ---------------- */

.jt-home {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 40px 24px;
    text-align: center;
}

.jt-home-art { width: 72px; height: 72px; margin-bottom: 10px; color: var(--jt-border-strong); }
.jt-home .jt-btn { margin-top: 16px; }

/* ---------------- New ticket ---------------- */

.jt-new {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.jt-new-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px 24px 28px;
}

.jt-step { display: flex; flex-direction: column; gap: 12px; }

.jt-step-t {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 14px;
    font-weight: 700;
}

.jt-step-t span {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--jt-text);
    color: var(--jt-surface);
    font-size: 12px;
}

/* Department radio cards */
.jt-choices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.jt-choice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--jt-border-strong);
    border-radius: 12px;
    background: var(--jt-surface);
    text-align: start;
    cursor: pointer;
    transition: border-color .15s var(--jt-ease), box-shadow .15s var(--jt-ease), background-color .15s var(--jt-ease);
}

.jt-choice:hover { border-color: var(--jt-muted); }
.jt-choice:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--jt-ring); }
.jt-choice.is-on { border-color: var(--jt-action); box-shadow: 0 0 0 1px var(--jt-action); background: var(--jt-brand-soft); }

.jt-choice-radio {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border: 1.5px solid var(--jt-border-strong);
    border-radius: 50%;
    background: var(--jt-surface);
    transition: border-color .15s var(--jt-ease), box-shadow .15s var(--jt-ease);
}

.jt-choice.is-on .jt-choice-radio { border-color: var(--jt-action); box-shadow: inset 0 0 0 4px var(--jt-surface); background: var(--jt-action); }

.jt-choice-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.jt-choice-t { font-size: 13.5px; font-weight: 700; color: var(--jt-text); }
.jt-choice-d { font-size: 12px; line-height: 1.8; color: var(--jt-muted); }

/* Pills (form choice, radio fields) */
.jt-pills { display: flex; flex-wrap: wrap; gap: 8px; }

.jt-pill {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding-inline: 14px;
    border: 1px solid var(--jt-border-strong);
    border-radius: 999px;
    background: var(--jt-surface);
    font-size: 13px;
    font-weight: 600;
    color: var(--jt-text-2);
    cursor: pointer;
    transition: border-color .15s var(--jt-ease), background-color .15s var(--jt-ease), color .15s var(--jt-ease);
}

.jt-pill:hover { border-color: var(--jt-muted); color: var(--jt-text); }
.jt-pill.is-on,
.jt-pill--radio:has(input:checked) { border-color: var(--jt-action); background: var(--jt-brand-soft); color: var(--jt-action); }
.jt-pill:focus-visible,
.jt-pill--radio:has(input:focus-visible) { outline: none; box-shadow: 0 0 0 3px var(--jt-ring); }
.jt-pill--radio input { position: absolute; opacity: 0; pointer-events: none; }

/* Fields */
.jt-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 16px;
}

.jt-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.jt-field.is-wide { grid-column: 1 / -1; }

.jt-label { font-size: 13px; font-weight: 600; color: var(--jt-text); }
.jt-req { color: var(--jt-danger); }
.jt-opt { font-size: 11.5px; font-weight: 400; color: var(--jt-muted); }

.jt-input {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid var(--jt-border-strong) !important;
    border-radius: var(--jt-radius-sm);
    background: var(--jt-surface);
    font-size: 14px;
    color: var(--jt-text);
    box-shadow: none !important;
    outline: none;
    transition: border-color .15s var(--jt-ease), box-shadow .15s var(--jt-ease);
}

.jt-input:hover { border-color: var(--jt-muted) !important; }
.jt-input:focus { border-color: var(--jt-action) !important; box-shadow: 0 0 0 3px var(--jt-ring) !important; }
.jt-input.is-ltr { direction: ltr; text-align: left; }
.jt-field.has-error .jt-input { border-color: var(--jt-danger) !important; }
.jt-field.has-error .jt-input:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .15) !important; }

.jt-textarea-wrap { position: relative; }
.jt-textarea { min-height: 150px; resize: vertical; line-height: 1.9; padding-bottom: 28px; }
.jt-textarea-wrap .jt-counter { position: absolute; inset-inline-end: 12px; bottom: 8px; }

.jt-select-wrap { position: relative; }
.jt-select { appearance: none; padding-inline-end: 38px; background-image: none; cursor: pointer; }
.jt-select-wrap::after {
    content: "";
    position: absolute;
    inset-inline-end: 16px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-inline-end: 1.5px solid var(--jt-muted);
    border-bottom: 1.5px solid var(--jt-muted);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

.jt-help { margin: 0; font-size: 12px; line-height: 1.8; color: var(--jt-muted); }
.jt-err { margin: 0; font-size: 12px; color: var(--jt-danger); }
.jt-counter { font-size: 11px; color: var(--jt-muted); font-variant-numeric: tabular-nums; }

/* Switch */
.jt-switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 13.5px; cursor: pointer; }
.jt-switch input { position: absolute; opacity: 0; pointer-events: none; }
.jt-switch-ui {
    position: relative;
    width: 40px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--jt-border-strong);
    transition: background-color .15s var(--jt-ease);
}
.jt-switch-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
    transition: inset-inline-start .15s var(--jt-ease);
}
.jt-switch input:checked + .jt-switch-ui { background: var(--jt-action); }
.jt-switch input:checked + .jt-switch-ui::after { inset-inline-start: 19px; }
.jt-switch input:focus-visible + .jt-switch-ui { box-shadow: 0 0 0 3px var(--jt-ring); }

/* Drop zone */
.jt-drop {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 22px 16px;
    border: 1.5px dashed var(--jt-border-strong);
    border-radius: 12px;
    background: var(--jt-surface);
    text-align: center;
    color: var(--jt-muted);
    transition: border-color .15s var(--jt-ease), background-color .15s var(--jt-ease);
}

.jt-drop:hover,
.jt-drop.is-over { border-color: var(--jt-action); background: var(--jt-brand-soft); }
.jt-drop:focus-within { box-shadow: 0 0 0 3px var(--jt-ring); }
.jt-drop svg { width: 26px; height: 26px; }
.jt-drop-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.jt-drop-t { font-size: 13px; font-weight: 600; color: var(--jt-text); }
.jt-drop-t u { color: var(--jt-action); text-underline-offset: 3px; }
.jt-drop-d { font-size: 11.5px; }

.jt-progress { width: min(240px, 80%); height: 4px; margin-top: 6px; border-radius: 99px; background: var(--jt-border); overflow: hidden; }
.jt-progress i { display: block; height: 100%; background: var(--jt-action); transition: width .2s linear; }

.jt-files { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }
.jt-files li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 6px 6px;
    border: 1px solid var(--jt-border);
    border-radius: 10px;
    background: var(--jt-surface);
    font-size: 12.5px;
}

.jt-file-ext {
    display: inline-grid;
    place-items: center;
    min-width: 40px;
    height: 32px;
    padding-inline: 6px;
    border-radius: 7px;
    background: var(--jt-soft);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .03em;
    color: var(--jt-text-2);
}

.jt-file-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; direction: ltr; text-align: right; }
.jt-file-size { flex-shrink: 0; color: var(--jt-muted); font-size: 11.5px; }

.jt-note, .jt-loading {
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--jt-soft);
    font-size: 13px;
    color: var(--jt-text-2);
}

.jt-loading { display: none; align-items: center; justify-content: center; }

/* Sticky footer with the submit button */
.jt-new-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid var(--jt-border);
    background: var(--jt-surface);
}

.jt-new-actions { display: flex; gap: 8px; }

/* ---------------- Conversation ---------------- */

.jt-thread { display: flex; flex-direction: column; min-height: 0; height: 100%; }

.jt-thread-head { align-items: flex-start; }
.jt-thread-title { flex: 1; min-width: 0; }
.jt-thread-title .jt-h2 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.jt-thread-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-top: 2px;
    font-size: 12px;
    color: var(--jt-muted);
}

.jt-uid {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: none;
    font-size: 12px;
    color: var(--jt-muted);
    cursor: pointer;
}

.jt-uid bdi { font-weight: 700; color: var(--jt-text-2); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.jt-uid span { padding: 0 6px; border-radius: 6px; background: var(--jt-soft); font-size: 11px; }
.jt-uid:hover span { color: var(--jt-text); }

.jt-thread-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.jt-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 24px 24px;
}

.jt-day { display: flex; justify-content: center; margin: 6px 0 2px; }
.jt-day span {
    padding: 2px 12px;
    border: 1px solid var(--jt-border);
    border-radius: 999px;
    background: var(--jt-surface);
    font-size: 11.5px;
    color: var(--jt-muted);
}

/* Messages: the seller's on the start side (right), support on the end side (left) */
.jt-msg { display: flex; align-items: flex-end; gap: 10px; max-width: min(640px, 86%); }
.jt-msg.is-mine { align-self: flex-start; }
.jt-msg.is-agent { align-self: flex-end; flex-direction: row-reverse; }
.jt-msg-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.jt-msg.is-agent .jt-msg-col { align-items: flex-end; }
.jt-msg.is-origin { flex-direction: column; align-items: stretch; gap: 4px; max-width: min(680px, 92%); }

.jt-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.95;
    overflow-wrap: anywhere;
}

.jt-msg.is-mine .jt-bubble { background: var(--jt-brand-soft); border: 1px solid color-mix(in srgb, var(--jt-brand) 18%, transparent); border-start-start-radius: 6px; color: var(--jt-text); }
.jt-msg.is-agent .jt-bubble { background: var(--jt-surface); border: 1px solid var(--jt-border); border-start-end-radius: 6px; }

.jt-msg-body > :first-child { margin-top: 0; }
.jt-msg-body > :last-child { margin-bottom: 0; }
.jt-msg-body p { margin: 0 0 8px; }
.jt-msg-body ul, .jt-msg-body ol { margin: 4px 0 8px; padding-inline-start: 20px; }
.jt-msg-body a { color: var(--jt-action); text-decoration: underline; text-underline-offset: 3px; }
.jt-msg-body code, .jt-msg-body pre { direction: ltr; font-size: 12.5px; background: var(--jt-soft); border-radius: 6px; padding: 1px 6px; }
.jt-msg-body pre { padding: 10px 12px; overflow-x: auto; }
.jt-msg-body blockquote { margin: 0 0 8px; padding-inline-start: 12px; border-inline-start: 3px solid var(--jt-border-strong); color: var(--jt-text-2); }
.jt-msg-img { display: inline-block; margin: 6px 0; }
.jt-msg-img img { max-width: min(320px, 100%); max-height: 260px; border-radius: 10px; border: 1px solid var(--jt-border); }

.jt-msg-meta { display: flex; align-items: center; gap: 6px; padding-inline: 6px; font-size: 11.5px; color: var(--jt-muted); }
.jt-tick { font-size: 11px; letter-spacing: -2px; color: var(--jt-muted); }
.jt-tick.is-seen { color: var(--jt-action); }

.jt-avatar {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    margin-bottom: 22px;
    border-radius: 50%;
    background: var(--jt-action);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.jt-origin-label { margin-bottom: 6px; font-size: 11.5px; font-weight: 700; color: var(--jt-action); }

.jt-kv { display: grid; gap: 6px; margin: 10px 0 0; padding-top: 10px; border-top: 1px dashed color-mix(in srgb, var(--jt-brand) 30%, transparent); }
.jt-kv div { display: flex; gap: 10px; font-size: 13px; }
.jt-kv dt { flex-shrink: 0; min-width: 96px; color: var(--jt-muted); }
.jt-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.jt-attach { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.jt-attach-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 112px;
    padding: 6px;
    border: 1px solid var(--jt-border);
    border-radius: 10px;
    background: var(--jt-surface);
    text-decoration: none;
    color: var(--jt-text-2);
    transition: border-color .15s var(--jt-ease);
}

.jt-attach-item:hover { border-color: var(--jt-action); }
.jt-attach-item img { width: 100%; height: 72px; object-fit: cover; border-radius: 6px; }
.jt-attach-item .jt-file-ext { width: 100%; height: 72px; font-size: 13px; }
.jt-attach-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; direction: ltr; font-size: 11px; text-align: center; }

.jt-waiting {
    display: flex;
    align-items: center;
    gap: 10px;
    align-self: center;
    margin-top: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--jt-surface);
    border: 1px solid var(--jt-border);
    font-size: 12.5px;
    color: var(--jt-text-2);
}

.jt-pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #D97706; }
.jt-pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #D97706; opacity: 0; animation: jt-pulse 1.8s ease-out infinite; }
@keyframes jt-pulse { 0% { transform: scale(.5); opacity: .7; } 100% { transform: scale(1.4); opacity: 0; } }

/* Composer */
.jt-composer { padding: 12px 20px 14px; border-top: 1px solid var(--jt-border); background: var(--jt-surface); }

.jt-composer-box {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 6px 6px 6px 6px;
    padding-inline-start: 14px;
    border: 1px solid var(--jt-border-strong);
    border-radius: 14px;
    background: var(--jt-surface);
    transition: border-color .15s var(--jt-ease), box-shadow .15s var(--jt-ease);
}

.jt-composer-box:focus-within { border-color: var(--jt-action); box-shadow: 0 0 0 3px var(--jt-ring); }
.jt-composer-box.has-error { border-color: var(--jt-danger); }

.jt-composer textarea {
    flex: 1;
    min-height: 40px;
    max-height: 220px;
    padding: 8px 0;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent;
    resize: none;
    font-size: 14px;
    line-height: 1.8;
    color: var(--jt-text);
}

.jt-send {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: 0;
    border-radius: 11px;
    background: var(--jt-action);
    color: #fff;
    cursor: pointer;
    transition: background-color .15s var(--jt-ease);
}

.jt-send:hover { background: var(--jt-action-hover); }
.jt-send:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--jt-surface), 0 0 0 4px var(--jt-action); }
.jt-send[disabled] { opacity: .7; }
.jt-send svg { width: 20px; height: 20px; }

.jt-spin { width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: jt-spin .7s linear infinite; }
@keyframes jt-spin { to { transform: rotate(360deg); } }

.jt-composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; margin-top: 6px; padding-inline: 4px; }
.jt-hint { font-size: 11.5px; color: var(--jt-muted); }
.jt-hint kbd { padding: 0 5px; border: 1px solid var(--jt-border-strong); border-bottom-width: 2px; border-radius: 5px; font-family: inherit; font-size: 10.5px; direction: ltr; }

.jt-closed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-top: 1px solid var(--jt-border);
    background: var(--jt-surface);
    font-size: 13px;
    color: var(--jt-text-2);
}

/* ---------------- Dark mode ---------------- */

.dark .jt { --jt-ring: rgba(0, 166, 81, .3); }
.dark .jt-msg.is-mine .jt-bubble { background: rgba(0, 166, 81, .12); }

/* ---------------- Responsive ---------------- */

@media (max-width: 1100px) {
    .jt-shell { grid-template-columns: 300px minmax(0, 1fr); }
}

/* Phones and small tablets: one pane at a time (inbox, or the open ticket / form) */
@media (max-width: 860px) {
    .jt { gap: 14px; }
    .jt-h1 { font-size: 19px; }
    .jt-lead { display: none; }

    .jt-shell {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
        min-height: 0;
        border-radius: 12px;
    }

    .jt-inbox { border-inline-end: 0; }
    .jt-list { max-height: none; overflow: visible; }

    .jt--home .jt-main { display: none; }
    .jt--new .jt-inbox,
    .jt--thread .jt-inbox { display: none; }
    .jt--new .jt-head .jt-btn,
    .jt--thread .jt-head { display: none; }

    .jt-back { display: inline-grid; }

    /* The open ticket fills the screen under the topbar like a chat app; only the
       messages scroll. Page padding and footer are dropped on this screen only. */
    .fi-main:has(.jt--thread) { padding-block: 8px !important; }
    body:has(.jt--thread) .jp-footer { display: none; }
    .jt--thread .jt-shell { height: calc(100dvh - 64px - 16px); }
    .jt-pane-head { padding: 10px 12px; }
    .jt-thread-head { flex-wrap: wrap; }
    .jt-thread-actions { width: 100%; justify-content: space-between; padding-inline-start: 52px; }
    .jt-messages { padding: 14px 12px 18px; }
    .jt-msg { max-width: 92%; }
    .jt-composer { padding: 10px 10px 12px; }
    .jt-hint { display: none; }

    .jt-new { height: auto; }
    .jt-new-body { overflow: visible; padding: 16px 14px 20px; }
    .jt-fields { grid-template-columns: minmax(0, 1fr); }
    .jt-choices { grid-template-columns: minmax(0, 1fr); }
    .jt-new-foot { position: sticky; bottom: 0; z-index: 2; padding: 10px 12px; }
    .jt-new-foot .jt-sub { display: none; }
    .jt-new-actions { width: 100%; }
    .jt-new-actions .jt-btn { flex: 1; min-height: 46px; }
    .jt-seg--fit { display: flex; }
    .jt-seg--fit button { flex: 1; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .jt *, .jt *::before, .jt *::after { transition: none !important; animation: none !important; }
}
