/* RTM OS — mobile-first (sales xem trên điện thoại khi đi tuyến) */
#workspace-rtm-os { background: #f8fafc; }
.rtm-wrap { max-width: 1280px; margin: 0 auto; padding: 14px 14px 80px; }

.rtm-head { margin-bottom: 12px; }
.rtm-title { margin: 0; font-size: 19px; font-weight: 700; color: #0f172a; }
.rtm-sub { margin: 4px 0 0; font-size: 13px; color: #64748b; line-height: 1.4; }

/* cards: stack trên mobile, 3 cột desktop */
.rtm-cards { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 14px; }
.rtm-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.rtm-card-warn { background: #fffbeb; border-color: #fde68a; }
.rtm-card-label { font-size: 12px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.rtm-card-num { font-size: 30px; font-weight: 800; line-height: 1.1; margin: 4px 0 2px; }
.rtm-card-foot { font-size: 12px; color: #94a3b8; }

/* filters: stack trên mobile */
.rtm-filters { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 14px; }
.rtm-f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: #475569; font-weight: 600; }
.rtm-f select {
  padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 9px; font-size: 15px;
  background: #fff; color: #0f172a; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.rtm-f select:disabled { background-color: #f1f5f9; color: #64748b; }

/* table */
.rtm-table-meta { font-size: 12px; color: #64748b; margin-bottom: 6px; font-weight: 600; }
.rtm-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rtm-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden; }
.rtm-table thead th {
  background: #f1f5f9; color: #475569; font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
  text-align: left; padding: 9px 12px; position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
.rtm-table td { padding: 11px 12px; border-top: 1px solid #f1f5f9; font-size: 14px; vertical-align: middle; color: #1e293b; }
.rtm-outlet strong { display: block; font-size: 14px; }
.rtm-seg { display: block; font-size: 11px; color: #94a3b8; margin-top: 1px; }
.rtm-sku strong { display: block; color: #0f172a; }
.rtm-sku-name { display: block; font-size: 11px; color: #94a3b8; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rtm-last { white-space: nowrap; font-size: 13px; color: #475569; }
.rtm-never { color: #b91c1c; font-weight: 600; }

.rtm-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.rtm-mand { background: #fee2e2; color: #b91c1c; }
.rtm-rec { background: #e0e7ff; color: #4338ca; }

.rtm-action-btn {
  border: 1px solid #2563eb; background: #2563eb; color: #fff; border-radius: 8px;
  padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.rtm-action-btn:hover { background: #1d4ed8; }
.rtm-action-btn:disabled { opacity: .7; cursor: default; }
.rtm-action-btn.rtm-done { background: #16a34a; border-color: #16a34a; }

.rtm-loading, .rtm-empty { padding: 30px; text-align: center; color: #94a3b8; font-size: 14px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; }

/* desktop */
@media (min-width: 720px) {
  .rtm-wrap { padding: 22px 28px 80px; }
  .rtm-title { font-size: 22px; }
  .rtm-cards { grid-template-columns: repeat(3, 1fr); }
  .rtm-cards-4 { grid-template-columns: repeat(4, 1fr); }
  .rtm-filters { grid-template-columns: repeat(3, minmax(0, 260px)); }
}

/* ── multi-tab shell ── */
.rtm-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.rtm-toolbar { display: flex; gap: 8px; }
.rtm-toolbar select { padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px; background: #fff; }
.rtm-tabbar { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 10px 0 14px; padding-bottom: 4px; }
.rtm-tab { flex: 0 0 auto; padding: 8px 14px; border: 1px solid #e2e8f0; background: #fff; border-radius: 999px; font-size: 13px; font-weight: 600; color: #475569; cursor: pointer; white-space: nowrap; }
.rtm-tab.active { background: #0f172a; color: #fff; border-color: #0f172a; }
.rtm-cards-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.rtm-rolebadge { font-size: 13px; color: #475569; margin-bottom: 10px; }
.rtm-sec { font-size: 14px; font-weight: 700; color: #0f172a; margin: 18px 0 8px; }
.num { text-align: right; }
.rtm-loading, .rtm-empty { padding: 28px; text-align: center; color: #94a3b8; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; }
.rtm-empty-sm { color: #94a3b8; font-size: 12px; padding: 6px; }

/* breakdown */
.rtm-bd-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.rtm-bd { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 12px; }
.rtm-bd-t { font-size: 12px; font-weight: 700; color: #64748b; text-transform: uppercase; margin-bottom: 6px; }
.rtm-bd-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; border-top: 1px solid #f1f5f9; }
@media (min-width: 720px) { .rtm-bd-grid { grid-template-columns: repeat(3, 1fr); } }

/* buttons */
.rtm-btn { padding: 10px 16px; border: none; border-radius: 9px; background: #2563eb; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.rtm-btn-2 { background: #0891b2; }
.rtm-pjp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.rtm-mini-btn { border: 1px solid #2563eb; background: #eff6ff; color: #1d4ed8; border-radius: 7px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.rtm-mini-btn.rtm-done { background: #16a34a; color: #fff; border-color: #16a34a; }
.rtm-rm { border: none; background: none; color: #b91c1c; cursor: pointer; font-weight: 700; }

/* beats */
.rtm-beats { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 720px) { .rtm-beats { grid-template-columns: repeat(2, 1fr); } }
.rtm-beat-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rtm-beat-meta { display: block; font-size: 12px; color: #94a3b8; }

/* modal */
.rtm-modal-ov { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 9999; }
.rtm-modal { background: #fff; width: 100%; max-width: 760px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; }
@media (min-width: 720px) { .rtm-modal-ov { align-items: center; } .rtm-modal { border-radius: 16px; } }
.rtm-modal-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; background: #fff; }
.rtm-modal-h .rtm-x { border: none; background: none; font-size: 18px; cursor: pointer; color: #64748b; }
.rtm-modal-b { padding: 14px 16px; }
.rtm-modal-act { margin-top: 14px; }
.rtm-fl { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 12px; }
.rtm-fl select, .rtm-fl input { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 15px; }
.rtm-search { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; margin-bottom: 8px; }

/* assign grid */
.rtm-assign-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 720px) { .rtm-assign-grid { grid-template-columns: 1fr 1fr; } }
.rtm-col-t { font-size: 12px; font-weight: 700; color: #64748b; margin-bottom: 6px; }
.rtm-assigned, .rtm-pool { max-height: 46vh; overflow-y: auto; border: 1px solid #eef2f7; border-radius: 8px; }
.rtm-arow { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-bottom: 1px solid #f1f5f9; cursor: grab; }
.rtm-aseq { background: #0f172a; color: #fff; border-radius: 50%; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; flex: 0 0 auto; }
.rtm-aname { flex: 1; font-size: 13px; }
.rtm-actrl button { border: 1px solid #e2e8f0; background: #fff; border-radius: 5px; cursor: pointer; font-size: 11px; padding: 2px 5px; }
.rtm-prow { display: flex; justify-content: space-between; align-items: center; padding: 7px 9px; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.rtm-prow button { border: 1px solid #2563eb; background: #eff6ff; color: #1d4ed8; border-radius: 6px; width: 26px; height: 26px; cursor: pointer; font-weight: 700; }

/* perfect store form */
.rtm-stock, #ps-comp { border: 1px solid #eef2f7; border-radius: 8px; padding: 6px; margin-top: 4px; max-height: 30vh; overflow-y: auto; }
.rtm-stockrow { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px; gap: 8px; }
.rtm-stockrow input { width: 80px; padding: 5px; border: 1px solid #cbd5e1; border-radius: 6px; }
.rtm-comprow { display: grid; grid-template-columns: 1fr 80px 1fr 28px; gap: 6px; margin-bottom: 6px; }
.rtm-comprow input { padding: 6px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; }
.rtm-scorebox { background: #f1f5f9; border-radius: 8px; padding: 10px 12px; font-weight: 700; color: #0f172a; font-size: 13px; }
.rtm-spark svg { vertical-align: middle; }

/* config msl */
.rtm-msl-seg { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.rtm-msl-h { font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.rtm-msl-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-top: 1px solid #f1f5f9; font-size: 13px; }
.rtm-msl-row span:first-child { flex: 1; }
.rtm-cin { padding: 5px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13px; }
