@media (min-width: 1181px) {
    .tjc-jms {
        display: none !important;
    }
}

.tjc-jms-overlay[hidden] {
    display: none !important;
}

@media (max-width: 1180px) {
    html.tjc-jms-lock,
    html.tjc-jms-lock body {
        overflow: hidden;
    }

    .tjc-jms-active > .tjc-stock-toolbar,
    .tjc-jms-active > .tjc-stock-table,
    .tjc-jms-active > .tjc-stock-row-buttons {
        display: none !important;
    }

    .tjc-jms {
        background: #fff;
        border: 1px solid rgba(16, 42, 67, 0.12);
        border-radius: 28px;
        box-shadow: 0 16px 38px rgba(31, 54, 83, 0.08);
        margin: 10px 0 12px;
        padding: 18px;
    }

    .tjc-jms-head {
        align-items: center;
        display: flex;
        gap: 12px;
        justify-content: space-between;
    }

    .tjc-jms-title {
        color: #64748b;
        font-size: 0.86rem;
        font-weight: 900;
        letter-spacing: 0.16em;
        text-transform: uppercase;
    }

    .tjc-jms-link {
        background: transparent;
        border: 0;
        color: #0ea5e9;
        font: inherit;
        font-weight: 800;
        padding: 0;
    }

    .tjc-jms-list {
        margin-top: 14px;
    }

    .tjc-jms-empty {
        background: transparent;
        border: 0;
        border-bottom: 1px solid rgba(15, 23, 42, 0.12);
        color: #0f172a;
        display: block;
        font: inherit;
        font-size: 1.02rem;
        font-weight: 800;
        min-height: 62px;
        padding: 14px 0;
        text-align: left;
        width: 100%;
    }

    .tjc-jms-row {
        border-bottom: 1px solid rgba(15, 23, 42, 0.12);
        display: grid;
        gap: 10px;
        grid-template-columns: 1fr;
    }

    .tjc-jms-row.is-reorder {
        align-items: center;
        grid-template-columns: 40px 1fr auto;
        padding: 10px 0;
    }

    .tjc-jms-row-main {
        align-items: center;
        background: transparent;
        border: 0;
        color: #0f172a;
        display: grid;
        font: inherit;
        gap: 12px;
        grid-template-columns: minmax(0, 1fr) auto;
        min-height: 66px;
        padding: 13px 0;
        text-align: left;
        width: 100%;
    }

    .tjc-jms-row-left,
    .tjc-jms-row-right {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    .tjc-jms-row-left strong,
    .tjc-jms-row-right strong {
        color: #0f172a;
        font-size: 1.02rem;
        line-height: 1.25;
    }

    .tjc-jms-row-left strong,
    .tjc-jms-row-left span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .tjc-jms-row-left span {
        color: #64748b;
        font-size: 0.84rem;
        margin-top: 4px;
    }

    .tjc-jms-row-right {
        align-items: flex-end;
        text-align: right;
        white-space: nowrap;
    }

    .tjc-jms-row-right strong {
        color: #64748b;
        font-size: 0.9rem;
        font-weight: 900;
    }

    .tjc-jms-add {
        align-items: center;
        background: transparent;
        border: 0;
        color: #0ea5e9;
        display: flex;
        font: inherit;
        gap: 12px;
        padding: 16px 0 2px;
        text-align: left;
        width: 100%;
    }

    .tjc-jms-add span {
        align-items: center;
        background: #0ea5e9;
        border-radius: 999px;
        color: #fff;
        display: inline-flex;
        font-size: 1.5rem;
        font-weight: 900;
        height: 38px;
        justify-content: center;
        line-height: 1;
        width: 38px;
    }

    .tjc-jms-add strong {
        font-size: 1rem;
    }

    .tjc-jms-delete {
        background: #ef4444;
        border: 0;
        border-radius: 999px;
        color: #fff;
        font-size: 1.45rem;
        font-weight: 900;
        height: 34px;
        line-height: 1;
        width: 34px;
    }

    .tjc-jms-move {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .tjc-jms-move button {
        background: #f8fafc;
        border: 1px solid rgba(15, 23, 42, 0.14);
        border-radius: 10px;
        color: #0f172a;
        font-weight: 900;
        height: 30px;
        width: 34px;
    }

    .tjc-jms-move button:disabled {
        opacity: 0.35;
    }

    .tjc-jms-overlay {
        background: #f8fbff;
        color: #0f172a;
        inset: 0;
        overflow: auto;
        padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px calc(env(safe-area-inset-bottom, 0px) + 24px);
        position: fixed;
        z-index: 999999;
    }

    .tjc-jms-panel {
        margin: 0 auto;
        max-width: 760px;
    }

    .tjc-jms-top {
        align-items: center;
        display: grid;
        gap: 10px;
        grid-template-columns: 54px 1fr 54px;
        margin-bottom: 22px;
    }

    .tjc-jms-top h2 {
        color: #0f172a;
        font-size: 1.35rem;
        font-weight: 900;
        margin: 0;
        text-align: center;
    }

    .tjc-jms-back,
    .tjc-jms-plus,
    .tjc-jms-save {
        align-items: center;
        background: #fff;
        border: 1px solid rgba(15, 23, 42, 0.12);
        border-radius: 999px;
        color: #0f172a;
        display: inline-flex;
        font-size: 2rem;
        font-weight: 400;
        height: 52px;
        justify-content: center;
        line-height: 1;
        width: 52px;
    }

    .tjc-jms-save,
    .tjc-jms-plus {
        background: #0ea5e9;
        border-color: #0ea5e9;
        color: #fff;
        font-size: 1.45rem;
        font-weight: 900;
    }

    .tjc-jms-search {
        align-items: center;
        background: #fff;
        border: 1px solid rgba(15, 23, 42, 0.14);
        border-radius: 22px;
        display: flex;
        gap: 10px;
        margin-bottom: 14px;
        padding: 0 14px;
    }

    .tjc-jms-search span {
        color: #64748b;
        font-size: 1.3rem;
    }

    .tjc-jms-search input {
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        color: #0f172a !important;
        font-size: 1rem !important;
        height: 52px !important;
        outline: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .tjc-jms-manual {
        display: grid;
        gap: 10px;
        grid-template-columns: minmax(0, 1fr) auto;
        margin-bottom: 18px;
    }

    .tjc-jms-manual input,
    .tjc-jms-manual button,
    .tjc-jms-editor-card input,
    .tjc-jms-editor-card textarea {
        border: 1px solid rgba(15, 23, 42, 0.14) !important;
        border-radius: 16px !important;
        box-shadow: none !important;
        font-size: 1rem !important;
        min-width: 0 !important;
    }

    .tjc-jms-manual input {
        height: 50px !important;
        padding: 0 14px !important;
    }

    .tjc-jms-manual button {
        background: #e8f0ff;
        color: #2563eb;
        font-weight: 900;
        min-width: 82px;
        padding: 0 16px;
    }

    .tjc-jms-options {
        background: #fff;
        border: 1px solid rgba(15, 23, 42, 0.1);
        border-radius: 24px;
        overflow: hidden;
    }

    .tjc-jms-option {
        background: transparent;
        border: 0;
        border-bottom: 1px solid rgba(15, 23, 42, 0.1);
        color: #0f172a;
        display: flex;
        flex-direction: column;
        font: inherit;
        gap: 4px;
        padding: 14px 16px;
        text-align: left;
        width: 100%;
    }

    .tjc-jms-option:last-child {
        border-bottom: 0;
    }

    .tjc-jms-option strong {
        font-size: 1rem;
    }

    .tjc-jms-option span,
    .tjc-jms-no-options {
        color: #64748b;
        font-size: 0.84rem;
    }

    .tjc-jms-no-options {
        padding: 18px;
    }

    .tjc-jms-editor-card {
        background: #fff;
        border: 1px solid rgba(15, 23, 42, 0.1);
        border-radius: 26px;
        box-shadow: 0 16px 38px rgba(31, 54, 83, 0.08);
        padding: 18px;
    }

    .tjc-jms-editor-item {
        align-items: center;
        background: transparent;
        border: 0;
        border-bottom: 1px solid rgba(15, 23, 42, 0.12);
        color: #0f172a;
        display: grid;
        font: inherit;
        gap: 10px;
        grid-template-columns: auto 1fr auto;
        margin-bottom: 18px;
        padding: 0 0 15px;
        text-align: left;
        width: 100%;
    }

    .tjc-jms-editor-item span,
    .tjc-jms-editor-card label {
        color: #0f172a;
        font-size: 0.95rem;
        font-weight: 800;
    }

    .tjc-jms-editor-item strong {
        color: #0ea5e9;
        font-size: 1rem;
        font-weight: 800;
        overflow: hidden;
        text-align: right;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .tjc-jms-editor-item em {
        color: #94a3b8;
        font-style: normal;
        font-size: 1.3rem;
    }

    .tjc-jms-editor-card label {
        display: block;
        margin-top: 16px;
    }

    .tjc-jms-editor-card input {
        height: 50px !important;
        margin-top: 8px !important;
        padding: 0 14px !important;
        width: 100% !important;
    }

    .tjc-jms-editor-card textarea {
        margin-top: 8px !important;
        min-height: 118px !important;
        padding: 12px 14px !important;
        resize: vertical;
        width: 100% !important;
    }
}

/* Mobile/tablet stock card cleanup: flatten nested wrappers without changing stock logic. */
@media (max-width: 1180px) {
    #tjc-new-jobcard-form .tjc-form-section:has(.tjc-stock-table-wrap),
    #tjc-jobcard-detail-form .tjc-form-section:has(.tjc-stock-table-wrap) {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    #tjc-new-jobcard-form .tjc-stock-table-wrap.tjc-jms-active,
    #tjc-jobcard-detail-form .tjc-stock-table-wrap.tjc-jms-active,
    .tjc-jobcard-shell .tjc-stock-table-wrap.tjc-jms-active,
    .tjc-frontend-wrap.tjc-form-page .tjc-stock-table-wrap.tjc-jms-active {
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        margin-top: 12px !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .tjc-jms {
        border-radius: 24px !important;
        margin: 8px 0 10px !important;
        padding: 16px 16px 14px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .tjc-jms-head {
        gap: 10px !important;
    }

    .tjc-jms-title {
        font-size: 0.8rem !important;
        letter-spacing: 0.13em !important;
    }

    .tjc-jms-link {
        font-size: 0.95rem !important;
        line-height: 1.25 !important;
        text-align: right !important;
    }

    .tjc-jms-list {
        margin-top: 10px !important;
    }

    .tjc-jms-empty {
        font-size: 1rem !important;
        min-height: 52px !important;
        padding: 11px 0 !important;
    }

    .tjc-jms-row-main {
        min-height: 56px !important;
        padding: 10px 0 !important;
    }

    .tjc-jms-add {
        padding-top: 12px !important;
    }

    .tjc-jms-add span {
        height: 34px !important;
        width: 34px !important;
        font-size: 1.35rem !important;
    }
}
