/* ============================================================
   KTN Contract Manager — Light theme
   White-first, one friendly blue accent, no dark surfaces.
   Class names are unchanged so every page template keeps working.
   ============================================================ */
:root {
  /* ── Core palette ─────────────────────────── */
  --primary:      #2F6FEB;
  --primary-600:  #2560D6;
  --primary-50:   #F2F6FF;
  --primary-100:  #E3ECFE;
  --primary-200:  #C9DAFD;

  --white:   #FFFFFF;
  --bg:      #FFFFFF;
  --surface: #F8FAFC;   /* subtle panels, table headers */
  --border:  #E6E9EF;
  --border-2:#EEF1F5;
  --text:    #1F2A37;   /* body text (kept readable) */
  --text-2:  #5B6675;
  --muted:   #98A2B3;

  --success:    #16A34A;  --success-50: #ECFDF3;
  --danger:     #E5484D;  --danger-50:  #FEF1F1;
  --warning:    #F59E0B;  --warning-50: #FFF8EB;
  --info:       #2F6FEB;  --info-50:    #F2F6FF;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.04);
  --shadow:    0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.03);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.10);
  --font: 'Inter', 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sidebar-w: 248px;

  /* ── Legacy names used inside page templates ─ */
  --espresso:   var(--text);
  --espresso2:  var(--text);
  --navy:       var(--primary);
  --navy2:      var(--primary-600);
  --gold:       var(--warning);
  --gold2:      #E08E00;
  --champagne:  var(--primary-200);
  --champ2:     var(--primary-200);
  --champ-pale: var(--primary-100);
  --champ-bg:   var(--primary-50);
  --cream:      var(--white);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, .serif { font-family: var(--font); letter-spacing: -0.01em; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary-200); outline-offset: 2px; }

/* ── Sidebar (slide-in menu, hidden until opened) ── */
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform .25s ease, box-shadow .25s ease;
  visibility: hidden;
}
#sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); visibility: visible; }
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px 10px 24px;
}
.sidebar-head-title { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }

/* Logo in the top bar, next to the menu button */
.topbar-brand { display: inline-flex; align-items: center; flex-shrink: 0; text-decoration: none; }
.topbar-logo { height: 54px; width: auto; max-width: 160px; margin: -8px 0; object-fit: contain; display: block; }
.topbar-brand-text { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; }
.topbar-divider { width: 1px; height: 32px; background: var(--border); margin: 0 18px; flex-shrink: 0; }
.sidebar-brand {
  padding: 22px 20px 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.sidebar-logo { width: auto; max-width: 140px; max-height: 44px; object-fit: contain; display: block; }
.sidebar-brand .brand-name { font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.2; }
.sidebar-brand .brand-sub {
  font-size: 11px; color: var(--muted); font-weight: 500;
  letter-spacing: .02em;
}
.sidebar-user {
  margin: 0 12px 6px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-100); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.user-info { min-width: 0; }
.user-name { font-size: 13px; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--muted); margin-top: 1px; text-transform: capitalize; }
.icon-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--primary-50); color: var(--primary); }

nav.sidebar-nav { flex: 1; padding: 8px 12px 12px; overflow-y: auto; }
.nav-section-label {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); padding: 16px 12px 6px;
}
.nav-item button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px; margin: 1px 0;
  background: none; border: none; border-radius: var(--radius-sm);
  color: var(--text-2);
  font-family: var(--font); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .15s, color .15s; text-align: left;
}
.nav-item button:hover { background: var(--surface); color: var(--text); }
.nav-item button.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.nav-item button i { font-size: 16px; width: 18px; text-align: center; }
.nav-item button.nav-sub { padding-left: 40px; font-size: 13px; }
.nav-item button.nav-sub i { font-size: 14px; }
.nav-item .badge-count {
  margin-left: auto;
  background: var(--primary-100); color: var(--primary);
  font-size: 11px; font-weight: 600;
  padding: 1px 8px; border-radius: 20px;
}
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.btn-signout {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; background: none; border: none; border-radius: var(--radius-sm);
  color: var(--text-2); font-family: var(--font); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .15s, color .15s;
}
.btn-signout:hover { background: var(--danger-50); color: var(--danger); }

/* ── Main Content ─────────────────────────── */
#main { margin-left: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--white); }
.topbar {
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.page-title { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; line-height: 1.3; }
.page-subtitle { font-size: 13px; color: var(--muted); margin-top: 1px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.content-area { padding: 28px 32px 40px; flex: 1; max-width: 1480px; width: 100%; margin: 0 auto; }

/* ── Cards ────────────────────────────────── */
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-header-styled {
  padding: 16px 20px; border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-header-styled h5 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.card-body-p { padding: 20px; }

/* ── Stat Cards ───────────────────────────── */
.stat-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card::before {
  content: ''; position: absolute; top: 18px; left: 20px;
  width: 8px; height: 8px; border-radius: 50%;
}
.stat-card.navy::before  { background: var(--primary); }
.stat-card.gold::before  { background: var(--warning); }
.stat-card.green::before { background: var(--success); }
.stat-card.red::before   { background: var(--danger); }
.stat-card.light::before { background: var(--primary-200); }
.stat-value { font-size: 30px; font-weight: 700; color: var(--text); line-height: 1.1; letter-spacing: -0.02em; margin-top: 18px; }
.stat-label { font-size: 13px; color: var(--text-2); margin-top: 4px; font-weight: 500; }
.stat-card.light .stat-value { color: var(--text-2); }

/* ── Tables ───────────────────────────────── */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.data-table th {
  background: var(--surface); color: var(--text-2);
  padding: 10px 16px; text-align: left;
  font-weight: 600; font-size: 12px; letter-spacing: .02em;
  position: sticky; top: 0; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-2); vertical-align: middle; color: var(--text); }
.data-table tbody tr { transition: background .12s; }
.data-table tr:hover td { background: #FAFBFD; }
.data-table tr:last-child td { border-bottom: none; }

/* ── Badges ───────────────────────────────── */
.badge-status {
  padding: 2px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.badge-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-draft     { background: #F2F4F7; color: #5B6675; }
.badge-issued    { background: var(--info-50); color: var(--primary); }
.badge-signed    { background: var(--success-50); color: var(--success); }
.badge-expired   { background: var(--danger-50); color: var(--danger); }
.badge-primary   { background: var(--primary-50); color: var(--primary); }
.badge-wholesale { background: #F4F1FE; color: #7A5AF8; }

/* ── Buttons ──────────────────────────────── */
.btn-navy, .btn-gold {
  background: var(--primary); color: #fff;
  border: 1px solid var(--primary); padding: 8px 16px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .15s, box-shadow .15s; display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 1px 2px rgba(47,111,235,.15); white-space: nowrap;
}
.btn-navy:hover, .btn-gold:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.btn-navy:disabled, .btn-gold:disabled { opacity: .6; cursor: not-allowed; }
.btn-outline {
  background: var(--white); color: var(--text);
  border: 1px solid var(--border); padding: 8px 14px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.btn-outline:hover { background: var(--surface); border-color: #D5DAE2; color: var(--text); }
a.btn-outline, a.btn-action, a.btn-navy { text-decoration: none; }
.btn-outline.active { background: var(--primary-50); color: var(--primary); border-color: var(--primary-200); }
.btn-danger-sm {
  background: none; border: none; color: var(--danger);
  cursor: pointer; font-size: 15px; padding: 4px 6px; border-radius: 6px;
  min-width: 30px; min-height: 30px; transition: background .15s;
}
.btn-danger-sm:hover { background: var(--danger-50); }
.btn-action {
  background: none; border: none; cursor: pointer; padding: 4px 6px; font-size: 16px;
  color: var(--text-2); border-radius: 6px; transition: background .15s, color .15s;
  min-width: 32px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center;
}
.btn-action:hover { color: var(--primary); background: var(--primary-50); }

/* ── Forms ────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; display: block; }
.form-label .req { color: var(--danger); }
.form-control, .form-select {
  width: 100%; padding: 9px 12px; border: 1px solid #D5DAE2;
  border-radius: var(--radius-sm); font-size: 14px; font-family: var(--font);
  background-color: var(--white); transition: border-color .15s, box-shadow .15s; color: var(--text);
  box-shadow: var(--shadow-sm);
}
.form-control::placeholder { color: var(--muted); }
.form-control:focus, .form-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-100);
}
.form-control[readonly], .form-control:disabled { background: var(--surface); color: var(--text-2); }
textarea.form-control { min-height: 84px; resize: vertical; }
.form-section {
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 18px; overflow: hidden; background: var(--white);
}
.form-section-header {
  background: var(--white); padding: 12px 18px; border-bottom: 1px solid var(--border-2);
  font-weight: 600; font-size: 14px; color: var(--text);
  display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.form-section-header i { color: var(--primary); }
.form-section-body { padding: 18px; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); }

/* ── Modal ────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(240,243,248,.75);
  backdrop-filter: blur(3px);
  z-index: 999; display: flex; align-items: flex-start;
  justify-content: center; padding: 56px 16px 16px;
  opacity: 0; transition: opacity .2s;
}
.modal-overlay.show { opacity: 1; }
.modal-box {
  background: var(--white); border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  width: 680px; max-width: 100%; max-height: calc(100vh - 80px);
  display: flex; flex-direction: column;
  transform: translateY(8px) scale(.99); transition: transform .2s;
}
.modal-overlay.show .modal-box { transform: none; }
/* number inputs: no ▲▼ spinner buttons (wheel / arrow keys are blocked in index.html) */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
/* click outside a form modal: small shake instead of closing */
.modal-overlay.show .modal-box.modal-nudge { animation: modal-nudge .3s ease; }
@keyframes modal-nudge { 0%,100% { transform: none; } 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.modal-header {
  padding: 18px 24px; border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h4 { margin: 0; font-size: 17px; color: var(--text); font-weight: 600; }
.modal-close {
  background: none; border: none; cursor: pointer; font-size: 16px; color: var(--muted);
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--surface); color: var(--text); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 24px; border-top: 1px solid var(--border-2);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--white); border-radius: 0 0 16px 16px;
}

/* ── Toast ────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast-msg {
  padding: 12px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  background: var(--white); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: slideIn .25s ease; min-width: 280px; max-width: 420px;
}
.toast-msg i { font-size: 18px; }
.toast-success i { color: var(--success); }
.toast-error   i { color: var(--danger); }
.toast-info    i { color: var(--primary); }
.toast-success { border-left: 4px solid var(--success); }
.toast-error   { border-left: 4px solid var(--danger); }
.toast-info    { border-left: 4px solid var(--primary); }
@keyframes slideIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Loading ──────────────────────────────── */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,.9);
  z-index: 800; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 14px;
}
.loading-spinner-lg { width: 36px; height: 36px; border: 3px solid var(--primary-100); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
.loading-text { font-size: 13px; color: var(--text-2); }

/* ── Filter Bar ───────────────────────────── */
.filter-bar {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  margin-bottom: 18px; box-shadow: var(--shadow-sm);
}
.filter-bar .form-group { margin-bottom: 0; min-width: 160px; }
.filter-bar .form-label { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }

/* ── Calendar Plan ───────────────────────── */
.cal-grid-container { overflow-x: auto; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 1px; background: var(--border); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.cal-header-cell {
  background: var(--surface); color: var(--text-2);
  text-align: center; font-size: 12px; font-weight: 600;
  padding: 10px 4px;
}
.cal-cell {
  background: var(--white); min-height: 104px; padding: 8px;
  cursor: pointer; transition: background .15s;
  display: flex; flex-direction: column; gap: 4px;
}
.cal-cell:hover { background: #FAFBFD; }
.cal-cell-empty { background: var(--surface); cursor: default; }
.cal-cell-today { background: var(--primary-50); }
.cal-day-num {
  font-size: 12px; font-weight: 600; color: var(--text-2);
  width: 24px; height: 24px; display: flex; align-items: center;
  justify-content: center; border-radius: 50%;
}
.cal-today-num { background: var(--primary); color: #fff; }
.cal-event-chip {
  background: var(--primary-100); color: var(--primary);
  border-radius: 6px; padding: 2px 8px; font-size: 11px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .15s; font-weight: 500;
}
.cal-event-chip:hover { background: var(--primary-200); }
.cal-event-more { font-size: 11px; color: var(--muted); padding-left: 2px; }

/* ── Pagination ───────────────────────────── */
.pagination { display: flex; gap: 4px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.pg-btn { min-width: 34px; padding: 6px 10px; border: 1px solid var(--border); background: var(--white); border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); transition: all .15s; }
.pg-btn.active { background: var(--primary-50); color: var(--primary); border-color: var(--primary-200); font-weight: 600; }
.pg-btn:hover:not(.active) { background: var(--surface); color: var(--text); }

/* ── Wizard Steps ─────────────────────────── */
.wizard-steps { display: flex; gap: 8px; margin-bottom: 24px; }
.wizard-step {
  flex: 1; padding: 12px 14px;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--muted); font-weight: 500;
}
.wizard-step:first-child, .wizard-step:last-child { border-radius: var(--radius-sm); }
.wizard-step.active { background: var(--primary-50); color: var(--primary); border-color: var(--primary-200); }
.wizard-step.done   { background: var(--success-50); color: var(--success); border-color: #C6EBD3; }
.step-num {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border);
}
.wizard-step.active .step-num { background: var(--primary); color: #fff; border-color: var(--primary); }
.wizard-step.done .step-num   { background: var(--success); color: #fff; border-color: var(--success); }

/* ── Dynamic Table (add rows) ─────────────── */
.dyn-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dyn-table th { background: var(--surface); padding: 8px 10px; font-weight: 600; font-size: 12px; color: var(--text-2); border-bottom: 1px solid var(--border); text-align: left; }
.dyn-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
.dyn-table input, .dyn-table select { width: 100%; padding: 6px 9px; border: 1px solid #D5DAE2; border-radius: 6px; font-size: 13px; color: var(--text); background: var(--white); font-family: var(--font); }
.dyn-table input:focus, .dyn-table select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }

/* ── Misc ─────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-2); }
.empty-state i {
  font-size: 26px; display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--primary-50); color: var(--primary); opacity: 1;
}
.search-input { position: relative; }
.search-input input { padding-left: 36px; }
.search-input i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); margin: 2px; }

/* Badges that already carry an icon don't need the dot */
.badge-status:has(i)::before { display: none; }

/* ── Multi-select dropdowns (styles are inline in the templates) ── */
.ms-wrap > button {
  padding: 9px 12px !important; border: 1px solid #D5DAE2 !important;
  border-radius: var(--radius-sm) !important; font-size: 14px !important;
  font-family: var(--font); color: var(--text) !important; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s; line-height: 1.5;
}
.ms-wrap > button:hover { border-color: #C4CBD6 !important; }
.ms-wrap > button:focus { outline: none; border-color: var(--primary) !important; box-shadow: 0 0 0 4px var(--primary-100); }
.ms-wrap .ms-lbl { font-size: 14px !important; }
.ms-wrap > button i { font-size: 12px !important; color: var(--muted) !important; }
.ms-panel {
  border: 1px solid var(--border) !important; border-radius: 10px !important;
  box-shadow: var(--shadow-lg) !important;
}
.ms-panel label:hover { background: var(--surface); }

/* ── Menu button + overlay ────────────────── */
.hamburger-btn {
  display: inline-flex; background: none; border: 1px solid var(--border); cursor: pointer;
  width: 40px; height: 40px; color: var(--text); font-size: 20px; line-height: 1;
  border-radius: 10px; margin-right: 14px; transition: background .15s, border-color .15s;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--primary-50); border-color: var(--primary-200); color: var(--primary); }
.sidebar-overlay {
  display: block; position: fixed; inset: 0; z-index: 99;
  background: rgba(240,243,248,.6); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D9DEE6; border-radius: 8px; border: 2px solid #fff; }
::-webkit-scrollbar-thumb:hover { background: #C4CBD6; }

/* ── Login ────────────────────────────────── */
#login-screen {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background:
    radial-gradient(900px 500px at 10% -10%, var(--primary-50), transparent 60%),
    radial-gradient(700px 400px at 110% 110%, #F3F7FF, transparent 60%),
    var(--white);
}
.login-card {
  width: 420px; max-width: 100%;
  background: var(--white); border: 1px solid var(--border); border-radius: 20px;
  padding: 40px 40px 32px; box-shadow: var(--shadow-lg);
}
.login-logo { max-width: 150px; max-height: 56px; object-fit: contain; display: block; margin: 0 auto 18px; }
.login-brand-text { display: none; font-size: 22px; font-weight: 700; color: var(--text); text-align: center; margin-bottom: 8px; }
.login-title { text-align: center; font-size: 22px; font-weight: 700; color: var(--text); margin: 0 0 4px; letter-spacing: -0.01em; }
.login-sub { text-align: center; font-size: 14px; color: var(--text-2); margin: 0 0 28px; }
.login-error {
  display: none; background: var(--danger-50); color: var(--danger); border: 1px solid #FBD5D6;
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px;
  align-items: center; gap: 8px;
}
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.pw-toggle:hover { color: var(--text); background: var(--surface); }
.login-btn { width: 100%; justify-content: center; padding: 11px; font-size: 15px; margin-top: 6px; }
.login-foot { text-align: center; margin-top: 24px; font-size: 12px; color: var(--muted); }

/* ── Sales e-signature ────────────────────── */
.badge-count-alert { background: var(--warning-50) !important; color: #B45309 !important; }
.sign-chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 11.5px; font-weight: 500; padding: 2px 9px; border-radius: 20px;
}
.sign-chip-pending { background: var(--warning-50); color: #B45309; }
.sign-chip-signed  { background: var(--success-50); color: var(--success); }
.sign-chip-rejected { background: var(--danger-50); color: var(--danger); }
.sign-reason {
  margin-top: 8px; padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.5;
  background: var(--danger-50); border: 1px solid #FBD5D6; color: var(--text); white-space: pre-wrap;
}
.sign-reason-label { font-size: 11px; font-weight: 600; color: var(--danger); margin-bottom: 2px; white-space: normal; }
.cr-list { display: flex; flex-direction: column; gap: 12px; max-height: 55vh; overflow-y: auto; }

/* ── Notification bell ────────────────────── */
.notif-wrap { position: relative; margin-right: 14px; }
.notif-btn { position: relative; margin-right: 0; }
.notif-btn.has-unread i { animation: notif-ring 1.6s ease 1; }
@keyframes notif-ring { 0%,100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-4deg); } }
.notif-badge {
  position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; border: 2px solid #fff; line-height: 1;
}
.notif-panel {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 200;
  width: 400px; max-width: calc(100vw - 32px);
  background: var(--white); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.notif-panel[hidden] { display: none; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border-2); font-size: 14px; }
.notif-head-sub { font-size: 12px; color: var(--muted); margin-left: 4px; }
.notif-link { background: none; border: none; color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.notif-link:hover { background: var(--primary-50); }
.notif-list { max-height: min(70vh, 520px); overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border-2); background: #FFFBFB; }
.notif-item:last-child { border-bottom: none; }
.notif-item.is-read { background: var(--white); }
.notif-item.is-read .notif-title, .notif-item.is-read .notif-reason { color: var(--text-2); font-weight: 400; }
.notif-icon { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.notif-icon.open { background: var(--danger-50); color: var(--danger); }
.notif-icon.warn { background: #FFF6E5; color: #C77D00; }
.notif-section { padding: 8px 16px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); background: var(--surface, #F6F8FB); border-bottom: 1px solid var(--border-2); }
.notif-section span { font-weight: 500; color: var(--muted); }
.notif-icon.resolved { background: var(--success-50); color: var(--success); }
.notif-body { min-width: 0; flex: 1; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text); }
.notif-cid { font-family: ui-monospace, Consolas, monospace; font-size: 12px; font-weight: 500; }
.notif-sub { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.notif-reason { font-size: 13px; color: var(--text); margin-top: 6px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.notif-meta { font-size: 11.5px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.notif-actions { display: flex; gap: 6px; margin-top: 10px; align-items: center; }
.notif-actions .btn-outline, .notif-actions .btn-navy { font-size: 12px; padding: 4px 10px; }
.notif-read-label { font-size: 12px; color: var(--success); display: inline-flex; align-items: center; gap: 4px; }
.notif-empty { padding: 36px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.notif-empty i { font-size: 24px; display: block; margin-bottom: 6px; }
.cr-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--white); }
.btn-reject { color: var(--danger) !important; }
.btn-reject:hover { background: var(--danger-50) !important; border-color: #FBD5D6 !important; }
.btn-danger-solid { background: var(--danger) !important; border-color: var(--danger) !important; }
.btn-danger-solid:hover { background: #D63B40 !important; }
.sign-hint { margin-top: 6px; font-size: 12px; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.sign-hint-ok { color: var(--success); }

.sign-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--white);
}
.sign-card + .sign-card { margin-top: 12px; }
.sign-card-id { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
.sign-card-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 2px 0 4px; }
.sign-card-meta { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.sign-card-note { margin-top: 8px; font-size: 13px; color: var(--text-2); background: var(--surface); border-radius: 8px; padding: 8px 10px; }

.modal-box.xl { width: 1120px; }
.sign-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; }
.sign-pdf { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); min-height: 60vh; }
.sign-pdf iframe { width: 100%; height: 62vh; border: 0; display: block; background: #fff; }
.sign-tabs { display: flex; gap: 4px; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.sign-tab {
  flex: 1; border: none; background: none; border-radius: 8px; padding: 7px 10px; cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.sign-tab.active { background: var(--white); color: var(--primary); box-shadow: var(--shadow-sm); }
.sign-drop {
  height: 180px; border: 1.5px dashed #C4CBD6; border-radius: var(--radius-sm); background: #FCFDFF;
  display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer;
  font-size: 13px; color: var(--text-2); padding: 12px; transition: border-color .15s, background .15s;
  background-image: linear-gradient(45deg, #F3F5F9 25%, transparent 25%), linear-gradient(-45deg, #F3F5F9 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #F3F5F9 75%), linear-gradient(-45deg, transparent 75%, #F3F5F9 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.sign-drop:hover, .sign-drop.drag { border-color: var(--primary); }
.sign-drop i { font-size: 26px; color: var(--primary); display: block; margin-bottom: 6px; }
#sign-drop-empty { background: rgba(255,255,255,.9); padding: 10px 14px; border-radius: 8px; }
.sign-drop img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sign-pad-wrap {
  position: relative; border: 1.5px dashed #C4CBD6; border-radius: var(--radius-sm);
  background: #FCFDFF; touch-action: none;
}
.sign-pad-wrap canvas { display: block; cursor: crosshair; touch-action: none; }
.sign-pad-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #C4CBD6; font-size: 18px; pointer-events: none;
}
.sign-pad-wrap::after {
  content: ''; position: absolute; left: 16px; right: 16px; bottom: 36px;
  border-bottom: 1px solid #E6E9EF; pointer-events: none;
}

/* ── Desktop: menu stays pinned open (☰ hides/shows it) ── */
@media (min-width: 992px) {
  #sidebar { transform: none; visibility: visible; box-shadow: none; }
  #main { margin-left: var(--sidebar-w); transition: margin-left .25s ease; }
  body.sidebar-collapsed #sidebar { transform: translateX(-100%); visibility: hidden; }
  body.sidebar-collapsed #main { margin-left: 0; }
  .sidebar-overlay { display: none; }
  .sidebar-head .icon-btn { display: none; }
}

@media (max-width: 768px) {
  #sidebar { width: min(86vw, var(--sidebar-w)); }
  .hamburger-btn { width: 36px; height: 36px; margin-right: 10px; }
  .topbar-logo { height: 44px; max-width: 110px; margin: -6px 0; }
  .notif-wrap { margin-right: 10px; }
  .notif-panel { position: fixed; top: 64px; left: 16px; right: 16px; width: auto; }
  .topbar { flex-wrap: wrap; row-gap: 10px; }
  .page-subtitle { display: none; }
  .topbar-actions { width: 100%; }
  .topbar-actions:empty { display: none; }
  .topbar-actions > * { flex: 1 1 auto; justify-content: center; }
  .data-table th, .data-table td { white-space: nowrap; }
  .topbar-divider { margin: 0 12px; height: 28px; }
  .content-area { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .page-title { font-size: 18px; }
  .wizard-steps { flex-direction: column; }
  .filter-bar .form-group { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .filter-bar .form-group .form-control,
  .filter-bar .form-group .form-select,
  .filter-bar .form-group .ms-wrap { width: 100% !important; }
  .login-card { padding: 32px 24px 24px; }
  .sign-layout { grid-template-columns: 1fr; }
  .sign-pdf, .sign-pdf iframe { min-height: 0; height: 45vh; }
  .sign-card { flex-direction: column; align-items: stretch; }
}

/* ── Agent Performance (public/js/agentperf.js) ── */
.ap-tabs { display: flex; gap: 4px; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 16px; overflow-x: auto; }
.ap-tab {
  flex: 0 0 auto; border: none; background: none; border-radius: 8px; padding: 7px 14px; cursor: pointer; white-space: nowrap;
  font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px;
}
.ap-tab.active { background: var(--white); color: var(--primary); box-shadow: var(--shadow-sm); }
.ap-note { font-size: 12px; color: var(--text-2); margin: 0 0 14px; line-height: 1.6; }
.ap-sub { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.ap-muted { color: var(--muted); }
.ap-up { color: var(--success); white-space: nowrap; }
.ap-down { color: var(--danger); white-space: nowrap; }
.ap-new { font-size: 11px; font-weight: 600; color: var(--primary); background: var(--primary-50); border-radius: 10px; padding: 1px 8px; }
.ap-count { font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0 8px; margin-left: 6px; }
.ap-kpi { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); height: 100%; }
.ap-kpi-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.ap-kpi-value { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; margin: 4px 0 2px; line-height: 1.2; }
.ap-kpi-sub { font-size: 12px; color: var(--text-2); }
.ap-chart { width: 100%; height: auto; display: block; }
.ap-tip {
  position: fixed; z-index: 2000; pointer-events: none; max-width: 300px;
  background: var(--white); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 8px 10px; font-size: 12px; line-height: 1.5;
}
.ap-bar-row { display: grid; grid-template-columns: minmax(0, 38%) 1fr auto; align-items: center; gap: 10px; padding: 5px 0; cursor: pointer; }
.ap-bar-row:hover .ap-bar-label { color: var(--primary); }
.ap-bar-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-bar-track { height: 10px; }
.ap-bar { height: 10px; background: #2a78d6; border-radius: 0 4px 4px 0; }
.ap-bar-value { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; min-width: 120px; }
.ap-bar-delta { display: inline-block; min-width: 62px; }
.ap-stack-label { font-size: 12px; color: var(--text-2); margin: 6px 0 4px; }
.ap-stack { display: flex; gap: 2px; height: 18px; border-radius: 4px; overflow: hidden; background: var(--white); }
.ap-stack > div { height: 100%; min-width: 2px; }
.ap-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.ap-mini { width: 100%; border-collapse: collapse; font-size: 13px; }
.ap-mini td { padding: 5px 4px; border-bottom: 1px solid var(--border-2); }
.ap-mini tr { cursor: pointer; }
.ap-mini tr:hover td { background: #FAFBFD; }
.ap-mini tr:last-child td { border-bottom: none; }
.ap-mini .ap-mini-head td { font-size: 11px; color: var(--text-2); font-weight: 600; }
.ap-mini .num, .ap-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ap-table td, .ap-table th { padding: 8px 12px; font-size: 13px; }
.ap-table tfoot td { background: var(--surface); font-weight: 600; border-top: 1px solid var(--border); position: sticky; bottom: 0; }
.ap-table-wrap { max-height: 70vh; overflow: auto; }
.ap-name { font-weight: 500; }
.ap-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.ap-check { font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.ap-edit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.ap-group { padding: 8px 0; border-bottom: 1px solid var(--border-2); }
.ap-group:last-child { border-bottom: none; }
@media (max-width: 767px) {
  .ap-bar-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ap-bar-track { grid-column: 1 / -1; grid-row: 2; }
  .ap-kpi-value { font-size: 20px; }
}
.ap-table .tag { white-space: nowrap; }
#ap-filters .ap-wide { min-width: 250px; }
.modal-body .ap-chart { max-height: 240px; }
.ap-verdict { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; margin: 1px 8px 1px 0; }
.ap-warn { margin-top: 10px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--warning-50); color: #92400e; font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.ap-warn i { color: var(--warning); margin-top: 2px; }
.ap-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--text-2); margin-top: 10px; }
.ap-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-chip { border: 1px solid var(--border); background: var(--white); border-radius: 16px; padding: 3px 10px; font-size: 12px; color: var(--text-2); cursor: pointer; font-family: var(--font); }
.ap-chip span { color: var(--muted); margin-left: 2px; }
.ap-chip.active { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.ap-file { display: inline-flex; align-items: center; gap: 3px; padding: 1px 5px; border-radius: 6px; text-decoration: none; color: var(--text-2); font-size: 12px; }
.ap-file:hover { background: var(--primary-50); color: var(--primary); }
.ap-file i { font-size: 15px; }
.ap-filegroup { padding: 8px 0; border-bottom: 1px solid var(--border-2); }
.ap-filegroup:last-child { border-bottom: none; }
.ap-filegroup-head { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.ap-filegroup-head .ap-muted { font-weight: 400; }
.ap-filelist { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.ap-filelist .ap-file { border: 1px solid var(--border); background: var(--white); padding: 3px 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Room Status (Allotment / Free sale / Close sale) ── */
.rs-toolbar { padding: 12px 16px; margin-bottom: 18px; position: sticky; top: var(--rs-top, 72px); z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.rs-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.rs-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.rs-hint { width: 100%; font-size: 12px; color: var(--text-2); margin: 0; }
.rs-hint kbd { font-family: var(--font); font-size: 11px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }
.rs-code-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--white); border-radius: 8px; padding: 5px 10px; font-family: var(--font); font-size: 13px; color: var(--text); cursor: pointer; }
.rs-code-btn:hover:not(:disabled) { border-color: var(--primary); }
.rs-code-btn:disabled { cursor: default; opacity: 1; }
.rs-code-btn input { margin: 0; }
.rs-swatch { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 4px; font-size: 11px; font-weight: 700; border: 1px solid rgba(0,0,0,.08); }
.rs-C { background: #DC2626; color: #fff; }
.rs-R { background: #FACC15; color: #422006; }
.rs-A { background: #38BDF8; color: #082F49; }
.rs-F { background: #84CC16; color: #1A2E05; }
.rs-none { background: var(--white); color: var(--muted); }
.rs-month { padding: 12px 14px 14px; margin-bottom: 14px; }
.rs-month-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-bottom: 10px; }
.rs-month-name { font-size: 15px; font-weight: 700; min-width: 140px; }
.rs-cut { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); margin: 0; }
.rs-cut .form-control { width: 70px; padding: 4px 8px; font-size: 13px; }
.rs-scroll { overflow-x: auto; }
.rs-grid { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.rs-grid th, .rs-grid td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; padding: 0; }
.rs-grid tr > :first-child { border-left: 1px solid var(--border); }
.rs-grid thead th { border-top: 1px solid var(--border); background: var(--surface); font-weight: 600; color: var(--text-2); min-width: 26px; height: 32px; line-height: 1.1; }
.rs-grid thead th small { display: block; font-size: 9px; font-weight: 500; color: var(--muted); }
.rs-grid thead th.rs-wkend { background: var(--primary-50); }
.rs-grid thead th.rs-today { box-shadow: inset 0 -3px 0 var(--primary); color: var(--primary); }
.rs-grid .rs-rt { position: sticky; left: 0; z-index: 1; background: var(--white); text-align: left; padding: 0 10px; min-width: 200px; max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; color: var(--text); }
.rs-grid thead .rs-rt { background: var(--surface); }
.rs-off { font-size: 11px; font-weight: 400; color: var(--muted); }
.rs-cell { width: 26px; min-width: 26px; height: 26px; font-weight: 700; font-size: 11px; }
.rs-editable .rs-cell, .rs-editable th[data-mi] { cursor: pointer; user-select: none; -webkit-user-select: none; }
.rs-cell.rs-dirty { background-image: linear-gradient(135deg, var(--text) 0 5px, transparent 5px); }
.rs-cell.rs-sel { box-shadow: inset 0 0 0 2px var(--text), inset 0 0 0 3px #fff; }
.rs-check-row { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.rs-check-col { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 14px; font-size: 13px; max-height: 220px; overflow-y: auto; }
.rs-check-row label, .rs-check-col label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
@media (max-width: 767px) {
  .rs-toolbar { position: static; }
  .rs-actions { margin-left: 0; }
  .rs-grid .rs-rt { min-width: 130px; max-width: 150px; padding: 0 6px; }
}
.rs-report-bar { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border-2); }
.rs-report-info { flex: 1; min-width: 220px; font-size: 12px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rs-cell.rs-changed:not(.rs-sel) { box-shadow: inset 0 0 0 2px #F59E0B; }
.rs-swatch.rs-changed-swatch { background: var(--white); box-shadow: inset 0 0 0 2px #F59E0B; width: 14px; height: 14px; vertical-align: -2px; }

/* ── Email a stop sale report (stopsalemail.js) ── */
.ss-head { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.ss-section-title { font-size: 13px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .03em; margin: 16px 0 10px; }
.ss-seg-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.ss-filter { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.ss-filter-label { font-size: 12px; color: var(--text-2); min-width: 86px; padding-top: 5px; }
.ss-filter .ap-chips { flex: 1; max-height: 92px; overflow-y: auto; }
.ss-filter .ap-chip a { color: inherit; text-decoration: none; margin-left: 4px; font-weight: 700; }
.ss-summary { font-size: 13px; color: var(--text-2); margin: 10px 0 6px; }
.ss-table-wrap { max-height: 340px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ss-table { margin: 0; }
.ss-table td, .ss-table th { font-size: 13px; vertical-align: top; }
.ss-table thead th { position: sticky; top: 0; z-index: 1; }
.ss-table tr.ss-off td { opacity: .55; }
.ss-contact { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 1px 0; cursor: pointer; flex-wrap: wrap; }
.ss-contact.ss-stop { font-weight: 600; }
.ss-email { color: var(--muted); font-weight: 400; }
.ss-level { font-size: 10px; font-weight: 600; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0 6px; }
.ss-stop .ss-level { color: #92400e; background: var(--warning-50); border-color: #FCD9A0; }
.ss-warn { font-size: 11px; color: #92400e; margin-top: 2px; }
@media (max-width: 767px) { .ss-filter { flex-direction: column; gap: 4px; } }
.rs-rtbar { padding: 12px 16px; margin-bottom: 14px; }
.rs-rtbar-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 13px; margin-bottom: 8px; }
.rs-rtbar-head a { font-size: 12px; }
.rs-rtbar-sub { color: var(--text-2); font-size: 12px; }
.rs-rtbar .ap-chip { font-size: 13px; padding: 5px 12px; }
.rs-dot { color: var(--warning); font-size: 10px; }
.sg-cond { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin: 1px 0; }
.sg-cond .rs-hint { width: auto; min-width: 56px; }
.btn-navy.ss-confirm { background: var(--success); border-color: var(--success); }
.sl-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.sl-kpi-v { font-size: 22px; font-weight: 700; margin-top: 2px; }
.sl-kpi-v small { font-size: 13px; font-weight: 500; }
@media (max-width: 767px) { .sl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ss-from { margin-top: 6px; }
.ss-sum { font-size: 12px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; cursor: pointer; }
