/* ==============================
   Realty Manager — Styles
   ============================== */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

:root {
  --rm-primary:       #1a472a;
  --rm-primary-light: #2d6a4f;
  --rm-accent:        #52b788;
  --rm-danger:        #e63946;
  --rm-warning:       #f4a261;
  --rm-info:          #4895ef;
  --rm-bg:            #f2f5f2;
  --rm-surface:       #ffffff;
  --rm-surface-2:     #edf2ed;
  --rm-border:        #dce8dc;
  --rm-text:          #1c2b1f;
  --rm-text-muted:    #6b7d70;
  --rm-text-light:    #9aab9e;
  --rm-sidebar-w:     256px;
  --rm-topbar-h:      60px;
  --rm-radius:        12px;
  --rm-radius-sm:     8px;
  --rm-shadow:        0 2px 8px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --rm-shadow-md:     0 4px 20px rgba(0,0,0,.10);
  --rm-transition:    .15s ease;
  --rm-font:          'DM Sans', sans-serif;
  --rm-mono:          'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
a { text-decoration: none; }

/* ========================
   LOGIN
   ======================== */
.rm-login-wrap {
  min-height: 70vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #e8f5e9 0%, #f2f5f2 60%, #dce8dc 100%);
  font-family: var(--rm-font);
}
.rm-login-card {
  background: var(--rm-surface);
  border-radius: 16px;
  padding: 40px 44px;
  width: 100%; max-width: 420px;
  box-shadow: var(--rm-shadow-md);
}
.rm-login-logo {
  display: flex; align-items: center; gap: 10px; margin-bottom: 28px;
}
.rm-login-logo span { font-size: 18px; font-weight: 700; color: var(--rm-primary); }
.rm-login-title { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.rm-login-sub { color: var(--rm-text-muted); margin-bottom: 28px; font-size: 15px; }
.rm-login-note { text-align: center; color: var(--rm-text-light); font-size: 12px; margin-top: 16px; }

/* ========================
   FORMS
   ======================== */
.rm-form-group { margin-bottom: 16px; }
.rm-form-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--rm-text); margin-bottom: 6px; font-family: var(--rm-font);
}
.rm-input, .rm-select, .rm-textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--rm-border);
  border-radius: var(--rm-radius-sm);
  font-family: var(--rm-font); font-size: 14px; color: var(--rm-text);
  background: var(--rm-surface); outline: none;
  transition: border-color var(--rm-transition), box-shadow var(--rm-transition);
}
.rm-input:focus, .rm-select:focus, .rm-textarea:focus {
  border-color: var(--rm-accent);
  box-shadow: 0 0 0 3px rgba(82,183,136,.14);
}
.rm-textarea { resize: vertical; min-height: 80px; }
.rm-select {
  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'%3E%3Cpath fill='%236b7d70' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
.rm-input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ========================
   BUTTONS
   ======================== */
.rm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--rm-radius-sm);
  font-family: var(--rm-font); font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: all var(--rm-transition);
  text-decoration: none; line-height: 1;
}
.rm-btn-primary  { background: var(--rm-primary); color: #fff; }
.rm-btn-primary:hover  { background: var(--rm-primary-light); }
.rm-btn-accent   { background: var(--rm-accent); color: #fff; }
.rm-btn-accent:hover   { background: #40a170; }
.rm-btn-danger   { background: var(--rm-danger); color: #fff; }
.rm-btn-danger:hover   { background: #c1121f; }
.rm-btn-ghost    { background: transparent; color: var(--rm-text-muted); border: 1.5px solid var(--rm-border); }
.rm-btn-ghost:hover    { background: var(--rm-surface-2); color: var(--rm-text); }
.rm-btn-sm       { padding: 7px 13px; font-size: 13px; }
.rm-btn-full     { width: 100%; }
.rm-btn-flex     { flex: 1; }
.rm-btn svg      { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ========================
   ALERTS
   ======================== */
.rm-alert { padding: 10px 14px; border-radius: var(--rm-radius-sm); font-size: 13px; margin-bottom: 16px; }
.rm-alert-error   { background: #fff0f0; color: var(--rm-danger); border: 1px solid #ffc9c9; }
.rm-alert-success { background: #f0fff4; color: var(--rm-primary); border: 1px solid #b7e4c7; }

/* ========================
   APP LAYOUT
   ======================== */
.rm-app {
  display: flex; min-height: 100vh;
  background: var(--rm-bg);
  font-family: var(--rm-font); color: var(--rm-text);
}

/* --- Sidebar --- */
.rm-sidebar {
  width: var(--rm-sidebar-w); background: var(--rm-primary);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
  transition: transform var(--rm-transition);
}
.rm-sidebar-header {
  padding: 18px 16px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.rm-sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  color: #fff; font-size: 15px; font-weight: 700;
}
.rm-sidebar-close {
  display: none; background: none; border: none;
  color: rgba(255,255,255,.5); cursor: pointer; font-size: 18px; padding: 4px 8px;
}

.rm-nav { padding: 10px 10px; flex: 1; overflow-y: auto; }
.rm-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--rm-radius-sm);
  color: rgba(255,255,255,.65); font-size: 14px; font-weight: 500;
  transition: all var(--rm-transition); margin-bottom: 2px;
  text-decoration: none;
}
.rm-nav-item svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.rm-nav-item:hover  { background: rgba(255,255,255,.1); color: #fff; }
.rm-nav-item.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.rm-nav-badge {
  margin-left: auto; background: var(--rm-danger); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 6px;
  border-radius: 20px; min-width: 18px; text-align: center; line-height: 1.5;
}

.rm-sidebar-footer {
  padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 10px;
}
.rm-user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.rm-user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--rm-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.rm-user-name { color: #fff; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-user-role { color: rgba(255,255,255,.45); font-size: 11px; }
.rm-logout-btn {
  background: rgba(255,255,255,.08); border: none; color: rgba(255,255,255,.6);
  border-radius: var(--rm-radius-sm); padding: 8px; cursor: pointer;
  transition: all var(--rm-transition); display: flex;
}
.rm-logout-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rm-logout-btn:hover { background: rgba(255,255,255,.16); color: #fff; }

/* --- Main --- */
.rm-main {
  flex: 1; margin-left: var(--rm-sidebar-w);
  display: flex; flex-direction: column; min-height: 100vh;
}
.rm-topbar {
  height: var(--rm-topbar-h); background: var(--rm-surface);
  border-bottom: 1px solid var(--rm-border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.rm-menu-toggle {
  display: none; background: none; border: none; cursor: pointer; color: var(--rm-text); padding: 4px;
}
.rm-menu-toggle svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.rm-topbar-title { font-size: 17px; font-weight: 700; flex: 1; }
.rm-topbar-actions { display: flex; gap: 8px; align-items: center; }
.rm-content { padding: 24px; flex: 1; }

/* ========================
   SECTION / BREADCRUMB
   ======================== */
.rm-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; flex-wrap: wrap; gap: 10px;
}
.rm-section-title { font-size: 19px; font-weight: 700; }
.rm-count { color: var(--rm-text-muted); font-weight: 400; font-size: 15px; }
.rm-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--rm-text-muted); margin-bottom: 14px;
}
.rm-breadcrumb a { color: var(--rm-accent); }
.rm-breadcrumb a:hover { text-decoration: underline; }
.rm-breadcrumb span { opacity: .5; }

/* ========================
   TOOLBAR / FILTERS
   ======================== */
.rm-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 20px;
}
.rm-toolbar .rm-input,
.rm-toolbar .rm-select { flex: 1; min-width: 140px; max-width: 240px; }
.rm-search-input { min-width: 200px; }

/* ========================
   STAT CARDS (Dashboard)
   ======================== */
.rm-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.rm-stat-card {
  background: var(--rm-surface); border-radius: var(--rm-radius);
  padding: 18px 20px; border: 1px solid var(--rm-border);
  box-shadow: var(--rm-shadow);
}
.rm-stat-card.span2 { grid-column: span 2; }
.rm-stat-label {
  font-size: 11px; font-weight: 700; color: var(--rm-text-muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px;
}
.rm-stat-value { font-size: 26px; font-weight: 700; color: var(--rm-text); line-height: 1; }
.rm-stat-sub { font-size: 12px; color: var(--rm-text-muted); margin-top: 4px; }
.rm-stat-card.green .rm-stat-value { color: var(--rm-primary); }
.rm-stat-card.teal  .rm-stat-value { color: var(--rm-accent); }
.rm-stat-card.orange .rm-stat-value { color: var(--rm-warning); }
.rm-stat-card.blue  .rm-stat-value { color: var(--rm-info); }
.rm-stat-card.red   .rm-stat-value { color: var(--rm-danger); }

/* ========================
   DATA CARDS (main content cards)
   ======================== */
.rm-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.rm-data-card {
  background: var(--rm-surface);
  border: 1px solid var(--rm-border);
  border-radius: var(--rm-radius);
  box-shadow: var(--rm-shadow);
  display: flex; flex-direction: column;
  transition: box-shadow var(--rm-transition), transform var(--rm-transition);
  overflow: hidden;
}
.rm-data-card:hover {
  box-shadow: var(--rm-shadow-md);
  transform: translateY(-1px);
}

.rm-data-card-header {
  padding: 14px 16px 10px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--rm-border);
}
.rm-data-card-title { font-size: 15px; font-weight: 700; color: var(--rm-text); line-height: 1.3; }
.rm-data-card-sub   { font-size: 12px; color: var(--rm-text-muted); margin-top: 2px; }
.rm-data-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

.rm-data-card-body  { padding: 12px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.rm-data-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  font-size: 13px; min-height: 20px;
}
.rm-data-label {
  font-size: 12px; font-weight: 600; color: var(--rm-text-muted);
  text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0; padding-top: 1px;
}
.rm-data-row > span:last-child { text-align: right; color: var(--rm-text); word-break: break-word; }
.rm-badges-wrap { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

.rm-data-card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--rm-border);
  background: var(--rm-surface-2);
}
.rm-card-actions-row { display: flex; gap: 8px; }

/* Generic card (non-grid, e.g. lot info box) */
.rm-card {
  background: var(--rm-surface); border: 1px solid var(--rm-border);
  border-radius: var(--rm-radius); box-shadow: var(--rm-shadow);
}

/* ========================
   BADGES
   ======================== */
.rm-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  white-space: nowrap;
}
.rm-badge-success  { background: #d4edda; color: #155724; }
.rm-badge-danger   { background: #f8d7da; color: #721c24; }
.rm-badge-warning  { background: #fff3cd; color: #856404; }
.rm-badge-info     { background: #d1ecf1; color: #0c5460; }
.rm-badge-secondary{ background: var(--rm-surface-2); color: var(--rm-text-muted); }

/* ========================
   MISC UTILITIES
   ======================== */
.rm-mono     { font-family: var(--rm-mono); }
.text-danger { color: var(--rm-danger) !important; }
.text-success{ color: var(--rm-accent) !important; }

.rm-progress { height: 8px; background: var(--rm-surface-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.rm-progress-bar { height: 100%; border-radius: 99px; background: var(--rm-accent); transition: width .4s ease; }

.rm-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rm-info-item .rm-info-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--rm-text-muted); margin-bottom: 3px; }
.rm-info-item .rm-info-val   { font-size: 14px; color: var(--rm-text); }

.rm-divider { border: none; border-top: 1px solid var(--rm-border); margin: 18px 0; }

.rm-proof-thumb {
  width: 48px; height: 48px; object-fit: cover;
  border-radius: var(--rm-radius-sm); border: 1px solid var(--rm-border);
  cursor: pointer;
}

/* Calc box (inside modal) */
.rm-calc-box {
  background: var(--rm-surface-2); border-radius: var(--rm-radius-sm);
  border: 1px solid var(--rm-border); padding: 14px 18px;
  margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px;
}
.rm-calc-item .rm-calc-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--rm-text-muted); margin-bottom: 4px; }
.rm-calc-item .rm-calc-val   { font-size: 16px; font-weight: 700; color: var(--rm-primary); font-family: var(--rm-mono); }

/* ========================
   EMPTY STATES
   ======================== */
.rm-empty-state {
  text-align: center; padding: 52px 24px; color: var(--rm-text-muted);
}
.rm-empty-icon  { font-size: 42px; margin-bottom: 14px; }
.rm-empty-title { font-size: 16px; font-weight: 600; color: var(--rm-text); margin-bottom: 8px; }
.rm-empty-state p { font-size: 14px; }

/* ========================
   MODAL
   ======================== */
.rm-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(2px);
  z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.rm-modal {
  background: var(--rm-surface); border-radius: var(--rm-radius);
  width: 100%; max-width: 580px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.22);
  animation: rmSlideUp .18s ease;
}
.rm-modal-lg { max-width: 740px; }
@keyframes rmSlideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.rm-modal-header {
  padding: 18px 22px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--rm-border);
}
.rm-modal-title { font-size: 16px; font-weight: 700; }
.rm-modal-close {
  background: none; border: none; font-size: 20px;
  color: var(--rm-text-muted); cursor: pointer; padding: 4px 8px;
  border-radius: var(--rm-radius-sm); transition: all var(--rm-transition); line-height: 1;
}
.rm-modal-close:hover { background: var(--rm-surface-2); }
.rm-modal-body   { padding: 20px 22px; overflow-y: auto; flex: 1; }
.rm-modal-footer {
  padding: 14px 22px; border-top: 1px solid var(--rm-border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ========================
   TOAST
   ======================== */
.rm-toast-container {
  position: fixed; bottom: 22px; right: 22px;
  z-index: 99999; display: flex; flex-direction: column; gap: 10px;
}
.rm-toast {
  padding: 11px 18px; border-radius: var(--rm-radius-sm);
  font-family: var(--rm-font); font-size: 14px; font-weight: 500; color: #fff;
  box-shadow: var(--rm-shadow-md); min-width: 220px;
  animation: rmToastIn .22s ease;
}
@keyframes rmToastIn { from { transform: translateX(16px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.rm-toast-success { background: var(--rm-primary); }
.rm-toast-error   { background: var(--rm-danger); }
.rm-toast-info    { background: var(--rm-info); }

/* ========================
   CONFIRM DIALOG
   ======================== */
.rm-confirm-body { text-align: center; padding: 10px 0; }
.rm-confirm-icon { font-size: 42px; margin-bottom: 14px; }
.rm-confirm-body p { color: var(--rm-text-muted); font-size: 14px; margin-top: 8px; }
.rm-btn-danger-outline { background: transparent; color: var(--rm-danger); border: 1.5px solid var(--rm-danger); }
.rm-btn-danger-outline:hover { background: var(--rm-danger); color: #fff; }

/* ========================
   SPINNER
   ======================== */
.rm-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--rm-border); border-top-color: var(--rm-accent);
  animation: rmSpin .7s linear infinite; margin: 0 auto; display: block;
}
@keyframes rmSpin { to { transform: rotate(360deg); } }

/* ========================
   MESSAGING
   ======================== */
.rm-msg-layout {
  display: grid; grid-template-columns: 280px 1fr;
  background: var(--rm-surface);
  border: 1px solid var(--rm-border); border-radius: var(--rm-radius);
  box-shadow: var(--rm-shadow);
  height: calc(100vh - var(--rm-topbar-h) - 52px);
  min-height: 480px; overflow: hidden;
}
.rm-msg-sidebar {
  border-right: 1px solid var(--rm-border);
  display: flex; flex-direction: column;
}
.rm-msg-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rm-border);
  display: flex; align-items: center; justify-content: space-between;
}
.rm-msg-sidebar-header h3 { font-size: 15px; font-weight: 700; }
.rm-msg-tabs {
  display: flex; border-bottom: 1px solid var(--rm-border);
}
.rm-msg-tab {
  flex: 1; padding: 10px 8px; font-size: 12px; font-weight: 600;
  text-align: center; color: var(--rm-text-muted);
  border-bottom: 2px solid transparent;
  text-decoration: none; transition: all var(--rm-transition);
  font-family: var(--rm-font);
}
.rm-msg-tab.active { color: var(--rm-primary); border-bottom-color: var(--rm-primary); background: var(--rm-surface-2); }
.rm-msg-tab:hover:not(.active) { background: var(--rm-surface-2); }

.rm-msg-list { flex: 1; overflow-y: auto; }
.rm-msg-item {
  display: block; text-decoration: none;
  padding: 13px 16px; border-bottom: 1px solid var(--rm-border);
  transition: background var(--rm-transition); position: relative; cursor: pointer;
}
.rm-msg-item:hover { background: var(--rm-surface-2); }
.rm-msg-item.active { background: #e8f5e9; border-left: 3px solid var(--rm-accent); }
.rm-msg-item.unread .rm-msg-item-subject { font-weight: 700; }
.rm-msg-item.unread::after {
  content: ''; position: absolute; top: 16px; right: 14px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--rm-accent);
}
.rm-msg-item-meta { display: flex; justify-content: space-between; margin-bottom: 3px; }
.rm-msg-item-from { font-size: 13px; font-weight: 600; color: var(--rm-text); }
.rm-msg-item-time { font-size: 11px; color: var(--rm-text-light); }
.rm-msg-item-subject { font-size: 13px; color: var(--rm-text); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-msg-item-preview { font-size: 12px; color: var(--rm-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-msg-empty { text-align: center; padding: 36px 20px; color: var(--rm-text-muted); font-size: 13px; }
.rm-msg-empty-icon { font-size: 30px; margin-bottom: 10px; }

.rm-msg-main { display: flex; flex-direction: column; background: var(--rm-bg); overflow: hidden; }
.rm-msg-placeholder {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--rm-text-muted); gap: 12px;
}
.rm-msg-placeholder svg { opacity: .2; }
.rm-msg-placeholder p { font-size: 14px; }

.rm-msg-thread-header {
  padding: 16px 20px 12px; background: var(--rm-surface);
  border-bottom: 1px solid var(--rm-border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.rm-msg-thread-subject { font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.rm-msg-thread-meta { font-size: 12px; color: var(--rm-text-muted); }

.rm-msg-thread-body {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.rm-msg-bubble {
  max-width: 70%; padding: 13px 16px; border-radius: 14px;
  font-size: 14px; line-height: 1.55;
}
.rm-msg-bubble.sent {
  align-self: flex-end; background: var(--rm-primary); color: #fff;
  border-bottom-right-radius: 4px;
}
.rm-msg-bubble.received {
  align-self: flex-start; background: var(--rm-surface); color: var(--rm-text);
  border: 1px solid var(--rm-border); border-bottom-left-radius: 4px;
}
.rm-msg-bubble-name { font-size: 11px; font-weight: 700; margin-bottom: 5px; opacity: .65; }
.rm-msg-bubble-time { font-size: 10px; margin-top: 6px; opacity: .55; text-align: right; }

.rm-msg-reply-box {
  padding: 12px 16px; border-top: 1px solid var(--rm-border);
  background: var(--rm-surface); display: flex; gap: 10px; align-items: flex-end;
}
.rm-msg-reply-input {
  flex: 1; resize: none; border: 1.5px solid var(--rm-border);
  border-radius: 10px; padding: 10px 14px;
  font-family: var(--rm-font); font-size: 14px; color: var(--rm-text);
  min-height: 44px; max-height: 120px; outline: none;
  transition: border-color var(--rm-transition);
}
.rm-msg-reply-input:focus { border-color: var(--rm-accent); box-shadow: 0 0 0 3px rgba(82,183,136,.12); }
.rm-msg-reply-send {
  background: var(--rm-primary); color: #fff; border: none; border-radius: 10px;
  padding: 10px 16px; cursor: pointer; display: flex; align-items: center; gap: 6px;
  font-family: var(--rm-font); font-size: 14px; font-weight: 600;
  transition: background var(--rm-transition);
}
.rm-msg-reply-send:hover { background: var(--rm-primary-light); }
.rm-msg-reply-send svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 900px) {
  .rm-card-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

@media (max-width: 768px) {
  .rm-sidebar { transform: translateX(-100%); }
  .rm-sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,.2); }
  .rm-sidebar-close { display: block; }
  .rm-menu-toggle { display: block; }
  .rm-main { margin-left: 0; }
  .rm-content { padding: 14px; }
  .rm-stats-grid { grid-template-columns: 1fr 1fr; }
  .rm-stat-card.span2 { grid-column: span 2; }
  .rm-card-grid { grid-template-columns: 1fr; }
  .rm-input-row { grid-template-columns: 1fr; }
  .rm-info-grid { grid-template-columns: 1fr; }
  .rm-calc-box { grid-template-columns: 1fr; }
  .rm-toolbar { flex-direction: column; align-items: stretch; }
  .rm-toolbar .rm-input,
  .rm-toolbar .rm-select { max-width: 100%; min-width: 0; }
  .rm-msg-layout {
    grid-template-columns: 1fr; grid-template-rows: auto 1fr;
    height: auto; min-height: 0;
  }
  .rm-msg-sidebar { max-height: 280px; border-right: none; border-bottom: 1px solid var(--rm-border); }
  .rm-msg-main { min-height: 360px; }
  .rm-msg-bubble { max-width: 88%; }
  .rm-modal { margin: 0 8px; }
  .rm-modal-body { padding: 16px; }
}

@media (max-width: 480px) {
  .rm-stats-grid { grid-template-columns: 1fr; }
  .rm-stat-card.span2 { grid-column: span 1; }
  .rm-login-card { padding: 28px 20px; }
  .rm-topbar { padding: 0 14px; }
  .rm-content { padding: 12px; }
  .rm-card-actions-row { flex-wrap: wrap; }
  .rm-card-actions-row .rm-btn { flex: 1; min-width: 80px; }
}

/* ========================
   PAGINATION
   ======================== */
.rm-pagination {
    margin-top: 24px;
    padding-bottom: 8px;
}

.rm-pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

.rm-page-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1.5px solid var(--rm-border);
    border-radius: var(--rm-radius-sm);
    background: var(--rm-surface);
    color: var(--rm-text);
    font-family: var(--rm-font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--rm-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.rm-page-btn:hover:not([disabled]):not(.active) {
    background: var(--rm-surface-2);
    border-color: var(--rm-accent);
    color: var(--rm-primary);
}

.rm-page-btn.active {
    background: var(--rm-primary);
    border-color: var(--rm-primary);
    color: #fff;
    font-weight: 700;
    cursor: default;
}

.rm-page-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

.rm-page-btn.rm-page-prev,
.rm-page-btn.rm-page-next {
    padding: 0 14px;
    font-size: 13px;
}

.rm-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 38px;
    color: var(--rm-text-muted);
    font-size: 14px;
    letter-spacing: .05em;
}

@media (max-width: 480px) {
    .rm-page-btn {
        min-width: 34px;
        height: 34px;
        font-size: 13px;
    }
}

/* ========================
   AJAX PAGE OVERLAY
   ======================== */
.rm-ajax-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99998;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(1px);
}

.rm-ajax-overlay.active {
    display: flex;
}

.rm-ajax-spinner {
    width: 56px;
    height: 56px;
    animation: rm-spin 0.8s linear infinite;
}

.rm-ajax-spinner svg {
    width: 100%;
    height: 100%;
}

@keyframes rm-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ========================
   LOTS FILTER CARD
   ======================== */

/* Toggle button badge (count of active filters) */
.rm-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--rm-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    border-radius: 20px;
    margin-left: 4px;
    line-height: 1;
}

/* Active filter chips row */
.rm-active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: #edf7f1;
    border: 1px solid #b7e4c7;
    border-radius: var(--rm-radius);
    margin-bottom: 16px;
    animation: rm-fade-in .18s ease;
}

@keyframes rm-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rm-active-filters-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--rm-text-muted);
    margin-right: 2px;
}

.rm-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px 3px 8px;
    background: var(--rm-surface);
    border: 1.5px solid var(--rm-border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--rm-text);
    white-space: nowrap;
}

.rm-filter-chip-label {
    font-weight: 600;
    color: var(--rm-text-muted);
}

.rm-filter-chip-val {
    font-weight: 500;
    color: var(--rm-primary);
}

.rm-filter-chip-clear {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: transparent;
    border: 1.5px dashed var(--rm-border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--rm-text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: all .15s;
    margin-left: 2px;
}
.rm-filter-chip-clear:hover {
    border-color: var(--rm-danger);
    color: var(--rm-danger);
    background: rgba(230,57,70,.06);
}
.rm-filter-chip-clear svg {
    flex-shrink: 0;
}

/* The filter card itself */
.rm-filter-card {
    background: var(--rm-surface);
    border: 1.5px solid var(--rm-border);
    border-radius: var(--rm-radius);
    margin-bottom: 20px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    overflow: hidden;
}

.rm-filter-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--rm-border);
    background: #f4f8f5;
}

.rm-filter-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--rm-primary);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.rm-filter-card-title svg {
    flex-shrink: 0;
    opacity: .7;
}

.rm-filter-card-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 50%;
    font-size: 14px;
    color: var(--rm-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    padding: 0;
}
.rm-filter-card-close:hover {
    background: var(--rm-surface-2);
    color: var(--rm-danger);
}

/* Grid of filter fields */
.rm-filter-card-body {
    padding: 20px 20px 0;
}

.rm-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px 16px;
}

.rm-filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rm-filter-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--rm-text-muted);
}

.rm-filter-field .rm-input,
.rm-filter-field .rm-select {
    font-size: 13px;
    height: 36px;
    padding: 0 10px;
}

/* Footer with action buttons */
.rm-filter-card-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    margin-top: 16px;
    border-top: 1px solid var(--rm-border);
    background: #f7faf7;
}

/* "This Month" and other footer buttons */
.rm-filter-card-footer .rm-btn {
    font-size: 12px;
    height: 32px;
    padding: 0 12px;
    gap: 5px;
}

@media (max-width: 1100px) {
    .rm-filter-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .rm-filter-grid { grid-template-columns: repeat(2, 1fr); }
    .rm-filter-card-footer { flex-wrap: wrap; }
}
@media (max-width: 480px) {
    .rm-filter-grid { grid-template-columns: 1fr; }
    .rm-active-filters { gap: 4px; }
}

/* Legacy classes kept for backward compat on other pages */
.rm-filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}
.rm-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.rm-filter-group--wide { grid-column: span 2; }
.rm-filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
    border-top: 1px solid var(--rm-border);
    margin-top: 4px;
}

/* Message sidebar section labels (Inbox / Sent) */
.rm-msg-section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--rm-text-muted);
    border-top: 1px solid var(--rm-border);
    margin-top: 4px;
}

.rm-msg-section-label:first-of-type {
    border-top: none;
    margin-top: 0;
}

.rm-msg-section-label--sent {
    color: var(--rm-accent);
}

/* Sent/received direction icon in conversation list */
.rm-msg-dir-icon {
    display: inline-block;
    vertical-align: middle;
    margin-right: 2px;
    flex-shrink: 0;
}

.rm-msg-dir-sent {
    opacity: .5;
}

/* Sent items are slightly muted vs received */
.rm-msg-item--sent .rm-msg-item-from {
    color: var(--rm-text-muted);
}
