/* Phần riêng của UliWork, dùng chung bộ giao diện với UliPOS (app.css). */
.id-badge { display: inline-block; margin-left: 6px; background: var(--text); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; vertical-align: middle; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 14px 0 18px; }
.kv span { color: var(--muted); }
.kv b { word-break: break-all; }
details summary { cursor: pointer; color: var(--muted); font-size: 14px; }

.org-mock { padding: 20px; }
.org-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.org-row small { color: var(--muted); }
.role-chip { display: inline-block; background: var(--orange-50); color: var(--orange-600); font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; margin: 0 6px 6px 0; }
.org-mods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.org-mods div { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 2px; }
.org-mods svg { color: var(--orange); }
.org-mods small { color: var(--muted); font-size: 12px; }
.step-n { font-weight: 700; color: var(--orange-600); font-size: 18px; }

.modules { margin-bottom: 16px; }
.module { display: flex; flex-direction: column; }
.module-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.module-head .ficon { margin: 0; color: var(--orange-600); }
.module-head h3 { margin: 0 0 4px; }
.module p { font-size: 14px; }
.module-act { margin-top: auto; }
.module-soon { opacity: .7; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.perm-grid p { margin: 4px 0 0; }

.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form select { width: auto; padding: 6px 8px; font-size: 13px; }
.menu { position: relative; display: inline-block; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(80, 50, 20, .14); z-index: 20; min-width: 230px; padding: 6px; text-align: left; }
.menu-pop form { margin: 0; }
.menu-pop button { width: 100%; text-align: left; border: 0; background: none; font: inherit; font-size: 14px; padding: 9px 10px; border-radius: 8px; cursor: pointer; color: var(--text); }
.menu-pop button:hover { background: var(--orange-50); }
.menu-pop button.text-danger { color: var(--danger); }
.invite-box { margin-bottom: 16px; border-color: var(--orange-100); background: linear-gradient(120deg, #fff, var(--orange-50)); }
.role-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.role-list li { font-size: 14px; }

/* Hộp thư */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; height: calc(100vh - 60px); }
.inbox-list, .inbox-thread { padding: 0; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.inbox-head { display: flex; align-items: center; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.inbox-head b { font-size: 16px; }
.inbox-head small { flex: 1 1 100%; order: 3; }
.inbox-head .btn { margin-left: auto; }
.inbox-list > input { margin: 10px 14px; width: auto; }
#convs { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 12px 14px; font: inherit; cursor: pointer; }
.conv:hover { background: #fffaf6; }
.conv.on { background: var(--orange-50); }
.conv-av { width: 40px; height: 40px; border-radius: 50%; background: var(--orange-100); color: var(--orange-600); font-weight: 700; display: grid; place-items: center; flex: none; overflow: hidden; }
.conv-av img { width: 100%; height: 100%; object-fit: cover; }
.conv-body { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-top small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.conv-last { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .conv-last { color: var(--text); font-weight: 600; }
.badge { background: var(--orange); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; }
.thread-empty { margin: auto; text-align: center; color: var(--muted); padding: 30px; max-width: 360px; }
.thread-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.thread-head small { color: var(--muted); }
.msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; background: #fffcfa; }
.msg { max-width: 72%; padding: 9px 13px; border-radius: 16px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.in { background: #fff; border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 5px; }
.msg.out { background: var(--orange); color: #fff; align-self: flex-end; border-bottom-right-radius: 5px; }
.msg small { display: block; font-size: 11px; opacity: .7; margin-top: 3px; }
.msg-day { align-self: center; font-size: 12px; color: var(--muted); background: var(--gray-50); padding: 2px 10px; border-radius: 999px; margin: 6px 0; }
.composer { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); align-items: flex-end; }
.composer textarea { resize: none; min-height: 44px; max-height: 160px; }
.newmsg { padding: 22px; display: grid; gap: 14px; max-width: 520px; }
.readonly-note { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox-list { max-height: 40vh; }
  .inbox-thread { min-height: 60vh; }
  .perm-grid, .org-mods { grid-template-columns: 1fr; }
}

/* ===== GĐ1: menu nhóm, tính năng, vai trò ===== */
.sidebar nav { gap: 2px; }
.nav-h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 4px; }
.trial-bar { background: var(--orange-50); border: 1px solid var(--orange-100); color: #7a4a24; border-radius: 12px; padding: 10px 14px; font-size: 14px; margin-bottom: 18px; }
.trial-bar.warn { background: var(--danger-50); border-color: #f7cfc8; color: var(--danger); }
.trial-bar a { font-weight: 600; margin-left: 6px; }
.plan-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--gray-50); color: #5b514a; vertical-align: 1px; }
.plan-badge.plan-basic { background: var(--blue-50); color: var(--blue); }
.plan-badge.plan-pro { background: var(--orange-50); color: var(--orange-600); }
.plan-badge.plan-enterprise { background: #2b2420; color: #fff; }
.note { background: #fffcf8; font-size: 14px; margin-bottom: 16px; }

.feat-group h2 { margin-bottom: 6px; }
.feat-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.feat-row:last-child { border-bottom: 0; }
.feat-row.locked b { color: var(--muted); }
.feat-row form { margin: 0; }
.switch { width: 42px; height: 24px; border-radius: 999px; border: 0; background: #d8cfc8; position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch span { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .15s; }
.switch.on { background: var(--ok); }
.switch.on span { left: 21px; }
.lock-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--gray-50); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.lock-badge svg { width: 13px; height: 13px; }
.limit-row { display: grid; grid-template-columns: 1fr 90px 64px; gap: 10px; align-items: center; font-size: 14px; margin: 10px 0; }
.limit-row b { text-align: right; font-size: 13px; }
.limit-row .bar i { background: var(--orange); }
.limit-row .bar i.full { background: var(--danger); }

.perm-cols { margin-top: 16px; align-items: start; }
.perm-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.perm-row:last-child { border-bottom: 0; }
.perm-row input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--orange); flex: none; }
.perm-row.off span { color: var(--muted); }
.role-card { color: var(--text); transition: border-color .15s, box-shadow .15s; }
.role-card:hover { border-color: var(--orange-100); text-decoration: none; box-shadow: 0 10px 30px rgba(240, 138, 60, .12); }
.role-card h2 { margin: 0; }
.dept-card h2 { margin: 0; }
.dept-card.editing { border-color: var(--orange); }
.dept-card .form-actions form { margin: 0; }
.dept-grid { align-content: start; }
.scope { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px 12px; margin: 0; }
.scope legend { font-size: 13px; font-weight: 600; color: #4a403a; padding: 0 4px; }
.scope-list { display: flex; flex-wrap: wrap; gap: 4px 16px; padding-left: 26px; }
.scope .check-row { font-size: 14px; }
