/*
 * Two-way texting (#109).
 * The thread panel (pop-up and inline), the Inbox, the badge in the top bar
 * and the dots on job cards. Everything is scoped to rm-sms-* so it cannot
 * touch the Inspinia theme.
 */

/* #125: another open order today (cart). Lives here because the cart already loads this file. */
.rm-other-open { margin-bottom: 10px; }
.rm-other-open-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(0,0,0,.08); }

/* ---- badge in the top bar and the sidebar ---- */
.rm-sms-badge { position: relative; display: inline-block; color: #676a6c; font-size: 18px; line-height: 1; padding: 0 10px; vertical-align: middle; text-decoration: none; }
.rm-sms-badge:hover { color: #1ab394; text-decoration: none; }
.rm-sms-count { position: absolute; top: -8px; right: 0; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px;
    border-radius: 9px; background: #e8232e; color: #fff; font-size: 11px; font-weight: 700; text-align: center; font-family: inherit; }
.nav .rm-sms-nav-count { float: right; margin-top: 2px; }

/* ---- the dot on a job card button ---- */
.rm-sms-card-btn { position: relative; }
.rm-sms-card-btn .rm-sms-dot { position: absolute; top: -5px; right: -5px; width: 12px; height: 12px; border-radius: 50%; background: #e8232e; border: 2px solid #fff; display: none; }
.rm-sms-card-btn.has-unread .rm-sms-dot { display: block; }

/* ---- thread panel ---- */
.rm-sms-dialog { max-width: 600px; }
.rm-sms-panel { display: flex; flex-direction: column; min-height: 0; color: #26262b; font-size: 14px; }
.rm-sms-head { border-top: 4px solid #1ab394; padding: 12px 16px 10px; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; border-bottom: 1px solid #e7eaec; }
.rm-sms-inline .rm-sms-head { border-top: 0; }
.rm-sms-head h4 { margin: 0; font-size: 18px; font-weight: 600; color: #2f4050; }
.rm-sms-meta { color: #6d7278; font-size: 12px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.rm-sms-meta a { color: #18a689; }
.rm-sms-type { font-size: 10px; border: 1px solid #5f1cb5; color: #5f1cb5; padding: 0 4px; text-transform: uppercase; }
.rm-sms-type.comm { border-color: #4e83c2; color: #4e83c2; }
.rm-sms-flag { margin-left: 6px; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border: 1px solid; border-radius: 2px; }
.rm-sms-flag.unknown { border-color: #999; color: #777; }
.rm-sms-flag.appt { border-color: #1c84c6; color: #1c84c6; }
.rm-sms-flag.dup { border-color: #e39a00; color: #b57600; }
.rm-sms-flag.dnt { border-color: #ed5565; color: #ed5565; }
.rm-sms-close { background: none; border: 0; font-size: 24px; line-height: 1; color: #999; padding: 0 2px; cursor: pointer; }
.rm-sms-close:hover { color: #333; }

.rm-sms-msgs { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; background: #fafafa; overflow-y: auto; max-height: 52vh; min-height: 160px; }
.rm-sms-inline .rm-sms-msgs { max-height: 460px; }
.rm-sms-day { align-self: center; color: #999; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin: 4px 0; }
.rm-sms-m { max-width: 80%; padding: 8px 11px; border-radius: 12px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.rm-sms-m small { display: block; white-space: normal; color: #7b8480; font-size: 11px; margin-top: 3px; }
.rm-sms-attachment { display: block; margin-top: 4px; }
.rm-sms-attachment img { display: block; max-width: 220px; width: 100%; height: auto; border-radius: 6px; }
.rm-sms-attachment-note { color: #777; font-size: 12px; margin-top: 4px; white-space: normal; }
.rm-sms-delivery { display: block; color: #527464; margin-top: 2px; }
.rm-sms-m.in { background: #eceff0; align-self: flex-start; border-bottom-left-radius: 3px; }
.rm-sms-m.out { background: #d9f1e8; align-self: flex-end; border-bottom-right-radius: 3px; }
.rm-sms-m.failed { border: 1px dashed #d9534f; background: #fdf1f0; }
.rm-sms-m.queued { opacity: .75; }
.rm-sms-tag { display: inline-block; background: #fff; border: 1px solid #cfd8d3; color: #4c5953; border-radius: 3px; padding: 0 5px; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; margin-right: 4px; }
.rm-sms-m small .rm-sms-err { color: #c0392b; font-weight: 600; }
.rm-sms-m small button { background: none; border: 0; color: #18a689; padding: 0; margin-left: 4px; cursor: pointer; font-size: 11px; text-decoration: underline; }
.rm-sms-sys { align-self: center; background: #fff; border: 1px solid #e2e2e2; color: #666; font-size: 12px; padding: 3px 10px; border-radius: 12px; }
.rm-sms-empty { padding: 28px 16px; color: #8a8f96; text-align: center; }

.rm-sms-compose { border-top: 1px solid #e7eaec; padding: 10px 16px 12px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.rm-sms-compose-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rm-sms-compose select.form-control { flex: 0 1 230px; height: 34px; }
.rm-sms-compose textarea.form-control { min-height: 60px; resize: vertical; }
.rm-sms-compose-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: #8a8f96; font-size: 12px; }
.rm-sms-compose-foot .rm-sms-send { min-width: 84px; }
.rm-sms-dnt { background: #fdf1f0; border: 1px solid #f1b0ac; color: #a94442; padding: 10px 12px; font-size: 13px; border-radius: 3px; margin: 10px 16px 12px; }
.rm-sms-msg { color: #c0392b; font-size: 13px; min-height: 0; }
.rm-sms-msg:empty { display: none; }
.rm-sms-mode { margin: 0 0 12px; padding: 8px 12px; font-size: 13px; color: #7a5a00; background: #fdf6dc; border: 1px solid #f0dc96; border-radius: 3px; }

/* link an unknown number */
.rm-sms-linkbox { padding: 10px 16px; border-bottom: 1px solid #e7eaec; background: #fff; }
.rm-sms-linkbox label { font-size: 12px; color: #6d7278; margin-bottom: 4px; display: block; }
.rm-sms-lookup { margin-top: 6px; }
.rm-sms-lookup button { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid #e7eaec; border-top: 0; padding: 7px 10px; font: inherit; cursor: pointer; }
.rm-sms-lookup button:first-child { border-top: 1px solid #e7eaec; border-radius: 3px 3px 0 0; }
.rm-sms-lookup button:last-child { border-radius: 0 0 3px 3px; }
.rm-sms-lookup button:hover { background: #f3f3f4; }
.rm-sms-lookup small { color: #8a8f96; margin-left: 6px; }

.rm-sms-new-customer fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.rm-sms-new-customer legend { font-size: 14px; font-weight: 600; border: 0; margin-bottom: 8px; }
.rm-sms-customer-toggle, .rm-sms-customer-actions { display: flex; gap: 6px; margin-bottom: 8px; }
.rm-sms-customer-actions { margin: 8px 0 0; }
.rm-sms-customer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; }
.rm-sms-customer-field { min-width: 0; }
.rm-sms-new-customer label .form-control { margin-top: 4px; font-weight: normal; font-size: 13px; }
.rm-sms-new-customer [aria-invalid="true"] { border-color: #c0392b; }
.rm-sms-field-error { font-size: 12px; color: #c0392b; margin-bottom: 4px; }
.rm-sms-field-error:empty { display: none; }
@media (max-width: 480px) {
    .rm-sms-customer-grid { grid-template-columns: 1fr; }
}

/* ---- the Inbox ---- */
.rm-sms-inbox-card { padding: 20px 22px 24px; }
.rm-sms-inbox { display: grid; grid-template-columns: 380px minmax(0, 1fr); border: 1px solid #e7eaec; min-height: 560px; }
.rm-sms-list { border-right: 1px solid #e7eaec; display: flex; flex-direction: column; min-width: 0; }
.rm-sms-tools { padding: 10px 12px; border-bottom: 1px solid #e7eaec; display: flex; flex-direction: column; gap: 8px; }
.rm-sms-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.rm-sms-chip { border: 1px solid #d2d2d2; border-radius: 14px; padding: 3px 11px; font-size: 12px; background: #fff; color: #444; cursor: pointer; font-family: inherit; }
.rm-sms-chip.on { background: #1ab394; border-color: #1ab394; color: #fff; }
.rm-sms-chip span { font-weight: 700; }
.rm-sms-q.form-control { height: 32px; font-size: 13px; }
.rm-sms-threads { overflow-y: auto; max-height: 70vh; }
.rm-sms-item { border: 0; border-bottom: 1px solid #eee; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 10px 12px; border-bottom: 1px solid #eee; font-size: 13px; width: 100%; text-align: left; background: #fff; border-left: 3px solid transparent; cursor: pointer; font-family: inherit; color: #26262b; }
.rm-sms-item:hover { background: #f7f8f8; }
/*
 * Three looks that must not be confused (Amy, 2026-11-25):
 * unread    = bold name and preview, a green dot and the red count; no background
 * selected  = the open conversation: light gray-blue background and a navy left bar
 * otherwise = normal weight. A search only narrows the list; matches look normal.
 */
.rm-sms-item b { font-size: 14px; font-weight: 400; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-sms-item .rm-sms-unread-dot { display: none; width: 8px; height: 8px; border-radius: 50%; background: #1ab394; margin-right: 6px; vertical-align: middle; position: relative; top: -1px; }
.rm-sms-item.un b { font-weight: 700; color: #1d1d21; }
.rm-sms-item.un .rm-sms-unread-dot { display: inline-block; }
.rm-sms-item.un .last { color: #26262b; font-weight: 600; }
.rm-sms-item.un .t { color: #1a8b74; font-weight: 600; }
.rm-sms-item.on, .rm-sms-item.on:hover { background: #eef2f6; border-left-color: #2f4050; }
.rm-sms-item:focus { outline: none; }
.rm-sms-item:focus-visible { outline: 2px solid #9fb3c8; outline-offset: -2px; }
.rm-sms-item .t { color: #999; font-size: 11px; text-align: right; white-space: nowrap; }
.rm-sms-item .last { grid-column: 1 / 3; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-sms-item .n { display: inline-block; background: #e8232e; color: #fff; border-radius: 8px; font-size: 10px; padding: 0 5px; margin-right: 4px; font-weight: 700; }
.rm-sms-pane { min-width: 0; display: flex; flex-direction: column; }
.rm-sms-pane .rm-sms-panel { flex: 1; }
.rm-sms-pane .rm-sms-msgs { flex: 1; max-height: none; }
.rm-sms-checked { color: #8a8f96; font-size: 12px; margin-right: 8px; }

/* customer page box */
.rm-sms-ibox { padding: 0 !important; }
.rm-sms-ibox-tools { display: flex; gap: 8px; align-items: center; }
.rm-sms-cust-threads a { font-size: 12px; margin-right: 6px; }

/* ---- phone ---- */
.rm-sms-back { display: none; background: none; border: 0; color: #18a689; font-size: 20px; line-height: 1; padding: 0 8px 0 0; cursor: pointer; }
@media (max-width: 767px) {
    .rm-sms-inbox { grid-template-columns: 1fr; min-height: 0; }
    .rm-sms-list { border-right: 0; }
    .rm-sms-inbox.showing-thread .rm-sms-list { display: none; }
    .rm-sms-inbox:not(.showing-thread) .rm-sms-pane { display: none; }
    .rm-sms-threads { max-height: none; }
    .rm-sms-back { display: inline-block; }
    .rm-sms-inbox-card { padding: 10px; }
    .rm-sms-msgs { max-height: 48vh; }
}

/* spam (Amy, 2026-11-25): soft, undoable, never deletes or blocks in RingCentral */
.rm-sms-flag.spam { border-color: #6d7278; color: #555; background: #f3f3f4; }
.rm-sms-spam-note { background: #f3f3f4; border: 1px solid #d9dcdf; color: #555; padding: 8px 12px; font-size: 12px; border-radius: 3px; margin: 8px 16px 0; }
.rm-sms-help { color: #8a8f96; font-size: 12px; padding: 8px 12px; border-bottom: 1px solid #e7eaec; }
