/* =========================
   wwwroot/css/site.css
   ========================= */

/* Base */
:root {
  scroll-behavior: smooth;
}

html {
  position: relative;
  min-height: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Poppins', sans-serif;
  background: #ffffff;
  font-size: 13px;
}

@font-face {
  font-family: "bootstrap-icons";
  src: url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/fonts/bootstrap-icons.woff2") format("woff2"),
    url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/fonts/bootstrap-icons.woff") format("woff");
  font-display: swap;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  margin-bottom: 0.75rem;
}

p,
label,
span {
  font-weight: 400;
}

/* button,
.btn {
  font-weight: 400;
} */

/* =========================================================
   Design Tokens
   ========================================================= */
:root {
  /* Layout */
  --topbar-height: 56px;
  --sidebar-width: 216px;
  --transition-duration: 0.25s;
  --form-action-bar-clearance: 4rem;

  /* Corporate theme (teal + dark slate) */
  --brand-teal: #33bfbf;
  --brand-teal-2: #19b4c4;
  --brand-slate: #0f172a;
  --brand-slate-2: #111827;

  /* Topbar */
  --topbar-bg: linear-gradient(315deg, #0b2236, #0f2f45);
  --topbar-text: #ffffff;

  /* Sidebar */
  --sidebar-bg: linear-gradient(180deg, #071a17 0%, #03110f 55%, #000b09 100%);
  --sidebar-color: rgba(255, 255, 255, 0.78);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-active-bg: rgba(255, 255, 255, 0.10);
  --sidebar-hover-bg: rgba(255, 255, 255, 0.07);
  --sidebar-active-border-left: var(--brand-teal);
  --sidebar-active-text-color: #eafffb;

  /* Toggle button */
  --toggle-bg: #ffffff;
  --toggle-fg: #000000;
  --toggle-border: rgba(15, 23, 42, 0.14);

  /* Notification panel */
  --notification-width: 420px;
  --notification-bg: #ffffff;

}

/* =========================================================
   Topbar (fixed)
   ========================================================= */
.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  z-index: 1030;
  background: var(--topbar-bg);
  color: var(--topbar-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);

  display: flex;
  align-items: center;
  gap: 12px;
}

/* Brand block aligns with sidebar width when sidebar is open */
.topbar-brand {
  position: relative;
  height: 100%;
  width: var(--sidebar-width);
  display: flex;
  align-items: center;
  padding-left: 14px;
  padding-right: 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

/* Logo */
.brand-link {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  padding-right: 40px;
  /* keeps logo centered between left edge and toggle */
}

.brand-logo {
  height: 34px;
  width: auto;
  display: block;
}

.brand-logo--mini {
  display: none;
}

/* keep for future */
.brand-logo--full {
  display: block;
}

.topbar-tenant {
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.9;
  max-width: 240px;
  padding-left: 24px;
}

.topbar-tenant .tenant-name {
  max-width: 100%;
}

@media (max-width: 767.98px) {
  .topbar-tenant {
    max-width: 140px;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
  }
}

/* Toggle button: single button on right edge of brand block */
.sidebar-edge-toggle {
  position: absolute;
  right: -16px;
  /* hang half outside */
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--toggle-border);
  background: var(--toggle-bg);
  color: var(--toggle-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgb(0, 0, 0);
  cursor: pointer;
  z-index: 1031;
  /* above sidebar edge */
}

.sidebar-edge-toggle:hover {
  filter: brightness(0.98);
}

/* topbar content area */
.topbar-content {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  padding-right: 12px;
  min-width: 0;
}

.topbar-content .user-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.topbar-content .user-dropdown-toggle::after {
  flex-shrink: 0;
  margin-left: 0.35rem;
}

.user-dropdown-toggle .user-name {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-content .btn-group {
  flex-shrink: 0;
}

.topbar-content #bell-button {
  flex-shrink: 0;
}

.topbar-content .user-dropdown {
  flex: 0 1 auto;
  min-width: 0;
  max-width: clamp(220px, 40vw, 640px);
}

.topbar-content .dropdown {
  position: relative;
}

.user-dropdown-toggle .bi-person-circle {
  flex-shrink: 0;
}

/* =========================================================
   Identity Manage (Account Settings)
   ========================================================= */
.manage-shell {
  padding-top: 12px;
  padding-bottom: 24px;
}

.manage-shell__header {
  padding: 12px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f4f7fb 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.manage-shell__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.manage-shell__subtitle {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 2px;
}

.manage-nav {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.manage-nav .nav-link {
  border-radius: 10px;
  margin: 4px 8px;
  color: #1f2937;
}

.manage-nav .nav-link.active {
  background: rgba(25, 180, 196, 0.12);
  color: #0f172a;
  font-weight: 600;
}

.manage-content {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.manage-content .form-control,
.manage-content .form-select {
  border-radius: 10px;
  border-color: rgba(15, 23, 42, 0.15);
}

@media (max-width: 767.98px) {
  .manage-shell__header {
    border-radius: 12px;
  }

  .manage-nav,
  .manage-content {
    border-radius: 12px;
  }
}

/* Followups table: bold headers, normal values */
#followupsTable thead th {
  font-weight: 600;
}

#followupsTable tbody td {
  font-weight: 400;
}

/* =========================================================
   App shell: sidebar + content under topbar
   ========================================================= */
.app-shell {
  padding-top: var(--topbar-height);
  min-height: 100vh;
}

/* =========================================================
   Sidebar (desktop)
   ========================================================= */
#sidebar {
  position: fixed;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;

  width: var(--sidebar-width);
  height: calc(100vh - var(--topbar-height));
  background: var(--sidebar-bg);
  color: var(--sidebar-color);

  border-right: 1px solid var(--sidebar-border);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.18);

  font-size: 0.92rem;
  overflow-y: auto;
  transition: width var(--transition-duration) ease;
  z-index: 1020;

  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

/* Webkit scrollbar */
#sidebar::-webkit-scrollbar {
  width: 6px;
}

#sidebar::-webkit-scrollbar-track {
  background: transparent;
}

#sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 10px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* =========================================================
   2-state sidebar: OPEN vs FULLY CLOSED
   ========================================================= */
html.sidebar-closed #sidebar {
  width: 0 !important;
  border-right: 0 !important;
  overflow: hidden !important;
}

/* Content wrapper shifts with sidebar */
#page-content-wrapper {
  margin-left: var(--sidebar-width);
  transition: margin-left var(--transition-duration) ease;
  min-height: calc(100vh - var(--topbar-height));
}

html.sidebar-closed #page-content-wrapper {
  margin-left: 0 !important;
}

html.sidebar-closed .topbar-brand {
  width: var(--sidebar-width);
}

@media (min-width: 768px) {
  .sidebar-edge-toggle {
    position: fixed;
    left: calc(var(--sidebar-width) - 17px);
    right: auto;
    top: calc(var(--topbar-height) / 2);
    transform: translateY(-50%);
  }
}

html.sidebar-closed .brand-logo {
  height: 34px;
}

/* Main content */
.app-main {
  padding: 0.75rem;
}

/* Full-width form opt-out for pages that need full-width toolbars */
.form-full-width {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

@media (min-width: 1440px) {
  .mw-xl6 {
    max-width: 72rem;
  }

  .filtercontianer {
    max-width: 600px;
    width: 40%;
  }
}


/* =========================================================
   Sidebar nav styles
   ========================================================= */
#sidebar .nav-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.55rem 0.85rem;
  color: inherit;
  border-radius: 2px;
  transition: background var(--transition-duration) ease, color var(--transition-duration) ease;
}

#sidebar .nav-link .bi {
  font-size: 1.15rem;
  min-width: 1.15rem;
}

#sidebar .sidebar-parent {
  justify-content: space-between;
}

#sidebar .sidebar-ic {
  font-size: 1.15rem;
  min-width: 1.15rem;
}

#sidebar .nav-link:hover {
  background: var(--sidebar-hover-bg);
}

#sidebar .nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text-color);
  border-left: 3px solid var(--sidebar-active-border-left);
  padding-left: calc(0.85rem - 3px);
}

/* submenu chevron rotate */
.nav-link[aria-expanded="true"]>.bi-chevron-right {
  transform: rotate(90deg);
  transition: transform var(--transition-duration) ease;
}

/* =========================================================
   Mobile: sidebar handled via Offcanvas
   ========================================================= */
@media (max-width: 767px) {
  #page-content-wrapper {
    margin-left: 0 !important;
  }

  .offcanvas.offcanvas-start {
    width: 280px;
    max-width: 100%;
  }

  .offcanvas-body {
    overflow-y: auto;
  }

  .topbar-brand {
    width: auto;
    border-right: 0;
  }

  .sidebar-edge-toggle {
    margin-left: 4px;
  }

  .brand-link {
    padding-right: 16px;
  }

  .qa-text {
    display: none !important;
  }

  .topbar-content {
    justify-content: flex-end;
    gap: 0.5rem;
  }

  .topbar-content .dropdown-menu {
    right: 0;
    left: auto;
  }

  .topbar-actions {
    gap: 0.5rem;
  }

  .topbar-content .user-dropdown {
    max-width: clamp(160px, 50vw, 300px);
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: flex-end;
}

/* On small screens: tighten spacing */
@media (max-width: 575px) {
  .topbar-content {
    padding-right: 8px;
  }

  .qa-text {
    display: none !important;
  }

  .btn-group .btn {
    padding-left: .5rem;
    padding-right: .5rem;
  }

  .topbar-actions {
    gap: 0.4rem;
  }

  .topbar-content .user-dropdown {
    max-width: clamp(140px, 60vw, 240px);
  }
}

/* =========================================================
   Notification bar (slides from right, under topbar)
   ========================================================= */
#notificationBar {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  width: var(--notification-width);
  height: calc(100vh - var(--topbar-height));
  background: #ffffff;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform var(--transition-duration) ease;
  display: flex;
  flex-direction: column;
  z-index: 1100;
  overflow: hidden;
}

html.show-notifications #notificationBar {
  transform: translateX(0);
}

#notificationBar .nb-header {
  background: #1f4a63;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

#notificationBar .nb-toolbar {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
}

#notificationBar .nb-body {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notification-list {
  flex: 1 1 auto;
}

.notification-item {
  border: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  padding: 0.75rem 0.9rem;
  transition: background-color 0.15s ease;
  align-items: flex-start !important;
  background: #f5f7fa;
}

.notification-item:hover {
  background-color: #f8fafc;
}

.notification-item.is-unread {
  background: #eef9ff;
}

.notification-item__content {
  min-width: 0;
}

.notification-item__leading {
  width: 1.5rem;
  padding-top: 0.1rem;
  color: #1f4a63;
  flex-shrink: 0;
}

.notification-item__top {
  margin-bottom: 0.25rem;
}

.notification-item__ref {
  font-size: 0.78rem;
  font-weight: 600;
  color: #0f172a;
}

.notification-item__time {
  color: #64748b;
  font-size: 0.74rem;
  white-space: nowrap;
}

.notification-item__message {
  color: #1e293b;
  font-size: 0.83rem;
  line-height: 1.4;
  margin-bottom: 0.35rem;
}

.notification-item__actions {
  display: flex;
  gap: 0.2rem;
  align-items: center;
  justify-content: flex-end;
}

.notification-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  border: 0;
  border-radius: 0.4rem;
  font-size: 0.95rem;
  line-height: 1.2;
  padding: 0.3rem;
  text-decoration: none;
  white-space: nowrap;
}

.notification-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.notification-item .notification-icon-btn {
  color: #475569;
  padding: 0.22rem;
}

.notification-item .notification-icon-btn:hover {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

.tooltip {
  z-index: 1205;
  pointer-events: none;
}

.notification-empty {
  padding: 1.25rem 1rem;
  text-align: center;
  color: #6b7280;
}

#notificationBar .btn-group .btn.active,
.notification-modal-toolbar .btn-group .btn.active {
  background: #1b394b;
  border-color: #1b394b;
  color: #fff;
}

#notification-modal-list {
  max-height: 60vh;
  overflow-y: auto;
}

.notifications-page-shell {
  min-height: calc(100vh - var(--topbar-height) - 2.5rem);
  display: flex;
  flex-direction: column;
}

.notifications-page-toolbar {
  background: #ffffff;
}

.notifications-page-body {
  flex: 1 1 auto;
  overflow-y: auto;
}

.notifications-page-shell .notification-item {
  padding-inline: 1.1rem;
}

/* =========================================================
   Drop Zone Styling (kept)
   ========================================================= */
#dropZone,
.attachment-dropzone {
  background-color: #f8f9fa;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
}

#dropZone {
  border: 2px dashed #6c757d !important;
  border-radius: 0.75rem !important;
}

#dropZone:hover {
  background-color: #ffffff !important;
  border-color: #0d6efd !important;
}

/* =========================================================
   Table Top Tabs Styling (Status, Visibility)
   ========================================================= */

.table-top-tabs .nav-link {
  color: #545454;
  background-color: #f1f3f5;
  padding: 0.2rem 1rem;
  margin-right: 5px;
  margin-bottom: 5px !important;
  border: 1px solid #545454;
  border-radius: 2px;
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.table-top-tabs .nav-link:hover,
.table-top-tabs .nav-link.active {
  background-color: #1b394b;
  color: #fff;
  border: 1px solid #1b394b;
}

.visibility-tabs .nav-link:hover,
.visibility-tabs .nav-link.active {
  background-color: #1b394b;
  color: #fff;
  border: 1px solid #1b394b;
}

/* =========================================================
   Recurrence Modal (kept)
   ========================================================= */
.recurrence-modal {
  border-radius: 1rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.recurrence-modal .modal-body {
  background-color: #f8f9fa;
  padding: 2rem;
}

.recurrence-modal .modal-footer {
  border-top: none;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
}

.recurrence-modal .modal-footer .btn {
  min-width: 50px;
  margin-left: 0.5rem;
}

/* =========================================================
   Print (kept + extended)
   ========================================================= */
@media print {

  .btn,
  nav,
  .no-print,
  #sidebar,
  #notificationBar,
  .offcanvas,
  .app-topbar {
    display: none !important;
  }

  #page-content-wrapper {
    margin-left: 0 !important;
  }

  body {
    background: #fff !important;
  }
}

/* Mobile offcanvas should match sidebar theme */
#mobileSidebar .offcanvas-header,
#mobileSidebar .offcanvas-body {
  background: var(--sidebar-bg);
  color: var(--sidebar-color);
}

#mobileSidebar .offcanvas-title {
  color: #fff;
}

#mobileSidebar .btn-close {
  filter: brightness(0) invert(1);
}

/* Sublinks: don’t justify space-between (looks broken) */
#sidebar .sidebar-sublink.nav-link {
  justify-content: flex-start;
  padding: 0.45rem 0.85rem;
  border-radius: 2px;
  opacity: 0.95;
}

#sidebar .sidebar-sublink.nav-link.active {
  background: rgba(255, 255, 255, 0.10);
  color: var(--sidebar-active-text-color);
  border-left: 3px solid var(--sidebar-active-border-left);
  padding-left: calc(0.85rem - 3px);
}

#toast-host {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1250;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

#toast-host .toast-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

#toast-host .tm-toast {
  min-width: 320px;
  max-width: 430px;
  pointer-events: auto;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 0.75rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  background: #ffffff !important;
  background-color: #ffffff !important;
  color: #0f172a;
  opacity: 1;
  overflow: hidden;
}

#toast-host .tm-toast:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

#toast-host .tm-toast__body {
  display: grid;
  grid-template-columns: 4px 1.15rem minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: start;
  padding: 0.7rem 0.72rem;
}

#toast-host .tm-toast__accent {
  width: 4px;
  border-radius: 999px;
  background: #64748b;
  align-self: stretch;
  min-height: 100%;
}

#toast-host .tm-toast__icon {
  color: #334155;
  font-size: 0.95rem;
  line-height: 1;
  margin-top: 0.1rem;
}

#toast-host .tm-toast__content {
  min-width: 0;
}

#toast-host .tm-toast__title {
  font-size: 0.84rem;
  line-height: 1.25;
  font-weight: 700;
  color: #0f172a;
}

#toast-host .tm-toast__message {
  margin-top: 0.15rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #1f2937;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#toast-host .tm-toast__meta {
  margin-top: 0.22rem;
  font-size: 0.72rem;
  color: #64748b;
}

#toast-host .tm-toast__actions {
  margin-top: 0.38rem;
}

#toast-host .tm-toast__action {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 0.45rem;
  padding: 0.15rem 0.58rem;
  font-size: 0.74rem;
  font-weight: 700;
}

#toast-host .tm-toast__action:hover {
  background: #eef2ff;
  border-color: #93c5fd;
}

#toast-host .tm-toast__action:focus-visible,
#toast-host .tm-toast__close:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

#toast-host .tm-toast__close {
  border: 0;
  background: transparent;
  color: #64748b;
  padding: 0.15rem;
  border-radius: 0.35rem;
  line-height: 1;
}

#toast-host .tm-toast__close:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}

#toast-host .tm-toast--info .tm-toast__accent {
  background: #2563eb;
}

#toast-host .tm-toast--success .tm-toast__accent {
  background: #059669;
}

#toast-host .tm-toast--warning .tm-toast__accent {
  background: #d97706;
}

#toast-host .tm-toast--error .tm-toast__accent {
  background: #dc2626;
}

@media (max-width: 575.98px) {
  #toast-host {
    left: 0.75rem;
    right: 0.75rem;
    top: 0.75rem;
  }

  #toast-host .tm-toast {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
}

.shared-users-list {
  max-height: 159px;
  overflow-y: auto;
}

.sticky-header {
  background: #fff;
  box-shadow: 0 10px 18px rgba(0, 0, 0, .04);
  isolation: isolate;
}

/* attachment dropzone */
.brd-dashed {
  border-style: dashed;
  border-width: 2px;
  border-radius: .5rem;
}

.attachment-dropzone:hover {
  background-color: #f1f3f5;
  border-color: var(--bs-primary);
}

.attachment-dropzone.attachment-has-files {
  border-color: var(--bs-success);
  background-color: #f0fff4;
}

.attachment-file-list {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.attachment-file-name {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#followupModal #attachmentFileList {
  max-height: 180px;
  overflow-y: auto;
}

#followupModal .attachment-file-list {
  align-items: stretch;
  gap: 0.35rem;
  font-size: 0.8rem;
}

#followupModal .attachment-file-list .border {
  padding: 0.35rem 0.5rem !important;
  border-color: #d7e0e8 !important;
}

#followupModal .attachment-file-list .attachment-file-name {
  max-width: none;
  min-width: 0;
  flex: 1 1 auto;
  font-size: 0.8rem;
}

#followupModal .attachment-file-list .attachment-remove {
  font-size: 0.75rem;
  line-height: 1.1;
}

[data-modal-movable="true"] .modal-content {
  position: relative;
  overflow: visible;
}

[data-modal-movable="true"] .tm-modal-move-handle {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border: 1px dashed #8aa0b1;
  border-radius: 0.35rem;
  background: #fff;
  color: #4f6474;
  cursor: move;
  z-index: 4;
  padding: 0;
  line-height: 1;
  touch-action: none;
  opacity: 0.7;
}

[data-modal-movable="true"] .tm-modal-move-handle--top-right {
  top: -0.55rem;
  right: -0.55rem;
}

[data-modal-movable="true"] .tm-modal-move-handle--bottom-left {
  left: -0.55rem;
  bottom: -0.55rem;
}

[data-modal-movable="true"] .tm-modal-move-handle i {
  font-size: 0.8rem;
}

[data-modal-movable="true"] .tm-modal-move-handle:hover,
[data-modal-movable="true"] .tm-modal-move-handle:focus-visible,
[data-modal-movable="true"] .modal-content.tm-modal-moving .tm-modal-move-handle {
  opacity: 1;
  border-color: #486173;
  color: #304a5d;
}

.document-attachment-queue {
  display: grid;
  gap: 0.75rem;
}

.document-attachment-queue-item {
  border: 1px solid #e6e9ee;
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.65rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.document-attachment-queue-item .form-control-sm:focus {
  border-color: #89a8bd;
  box-shadow: 0 0 0 0.15rem rgba(27, 57, 75, 0.12);
}

.document-attachment-name-wrap .document-attachment-name-display {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 2rem;
}

.document-attachment-name-wrap .js-document-queue-name-trigger {
  color: #1b394b;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
}

.document-attachment-name-wrap .js-document-queue-name-trigger:hover {
  text-decoration: underline;
}

.document-attachment-name-wrap .js-document-queue-name-edit {
  color: #64748b;
}

/* Accessibility: visible focus outlines */
/* :focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
} */

.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible {
  box-shadow: unset !important;
  outline: none !important;
  border: 1px solid #9a9a9a;
  background-color: transparent;
}

/* Validation summary readability */
.validation-summary-errors {
  font-weight: 600;
}

/* Tasks Followups Description area */
.remark {
  width: 100%;
  align-items: flex-start;
  vertical-align: top;
}

.text-break {
  word-break: break-word;
}

/* toggle states: clamped vs expanded */
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ensure only one state shows */
details[open] .state-clamped {
  display: none;
}

details:not([open]) .state-expanded {
  display: none;
}

/* clean full text display */
.expanded-box {
  margin-top: .5rem;
  padding: .6rem .75rem;
  border-radius: 12px;
  background: rgba(248, 249, 250, 1);
  border: 1px solid rgba(0, 0, 0, .05);
  white-space: normal;
}

/* make it look like a button link */
details summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

details summary::-webkit-details-marker {
  display: none;
}

.followup-remark-col {
  width: 50%;
  max-width: 50%;
}

@media (max-width: 992px) {
  .followup-remark-col {
    width: auto;
    max-width: none;
  }
}

/* keep it tabular by allowing horizontal scroll naturally */
.task-page .task-table-scroll {
  overflow-x: auto;
}

/* Description area */
.remark {
  width: 100%;
  align-items: flex-start;
  text-align: left !important;
}

.text-break {
  word-break: break-word;
}

/* 2) toggle states: clamped vs expanded */
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ensure only one state shows */
details[open] .state-clamped {
  display: none;
}

details:not([open]) .state-expanded {
  display: none;
}

/* clean full text display */
.expanded-box {
  margin-top: .5rem;
  padding: .6rem .75rem;
  border-radius: 12px;
  background: rgba(248, 249, 250, 1);
  border: 1px solid rgba(0, 0, 0, .05);
  white-space: normal;
}

/* make it look like a button link */
details summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

details summary::-webkit-details-marker {
  display: none;
}

/* Recurrence toggle button */
.recurrence-toggle-btn--active {
  border-color: #0d6efd;
  color: #0d6efd;
  background-color: rgba(13, 110, 253, 0.08);
  box-shadow: 0 0 0 1px rgba(13, 110, 253, 0.15);
}

.recurrence-status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  background-color: transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.recurrence-status-indicator--active {
  background-color: #0d6efd;
  border-color: #0d6efd;
  transform: scale(1.15);
}

/* weekly day toggle pills */
.weekly-day-group {
  margin-top: .25rem;
}

.weekly-day-toggle {
  position: relative;
}

.weekly-day-label {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--bs-border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  background-color: #fff;
  color: var(--bs-body-color);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

/* selected state */
.weekly-day-input:checked+.weekly-day-label {
  background-color: var(--bs-warning);
  border-color: var(--bs-warning);
  color: #000;
}

/* hover */
.weekly-day-label:hover {
  border-color: var(--bs-warning);
}

/* Followups: limit panel height + scroll internal lists */
.tm-panel {
  /* keep both panels same height in row */
  min-height: 220px;
}

.tm-panel .card-body {
  /* enables internal scroll sections */
  min-height: 0;
}

/* Main scroll region */
.tm-panel__scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 360px;
  /* desktop */
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Smaller secondary scroll (exit requests) */
.tm-panel__scroll-sm {
  max-height: 220px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Prevent long names from breaking layout */
.tm-panel .min-w-0 {
  min-width: 0;
}

/* Mobile tuning */
@media (max-width: 576px) {
  .tm-panel__scroll {
    max-height: 260px;
  }
}

.task-desc-popover .popover-body {
  font-size: 14px;
  line-height: 1.4;
}

/* Task create/edit: customer search dropdown */
.customer-search-wrap {
  position: relative;
}

.customer-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1060;
  display: none;
  max-height: 260px;
  overflow-y: auto;
  background-color: #fff;
  border: 1px solid #e3e7ef;
  border-radius: 0.5rem;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.customer-search-results.is-open {
  display: block;
}

.customer-search-item.active,
.customer-search-item:focus {
  background-color: #f0f6ff;
}

.customer-search-status {
  color: #6c757d;
  cursor: default;
}

.customer-search-footer {
  background-color: #f8f9fa;
}

.customer-search-loadmore {
  font-weight: 600;
}

mark.customer-search-highlight {
  background-color: #ffe7a3;
  padding: 0 2px;
}

.master-links-panel .mapping-checklist {
  max-height: 320px;
  overflow-y: auto;
  background-color: #fff;
}

.master-links-panel .mapping-check-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 0.45rem;
  transition: background-color 0.15s ease;
}

.master-links-panel .mapping-check-item:hover {
  background-color: #f6f9ff;
}

.master-links-panel .master-mapping-search {
  width: 100%;
}

.master-mapping-grid .master-links-panel {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.master-mapping-grid .master-links-panel.master-step-locked {
  opacity: 0.72;
  border-style: dashed !important;
}

.master-mapping-grid .mapping-checklist {
  flex: 1 1 auto;
}

.master-mapping-toolbar {
  padding: 0.25rem 0;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.master-mapping-host {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
  padding-bottom: 0;
}

@media (max-width: 767.98px) {
  .master-mapping-host {
    margin-top: 0.375rem;
    margin-bottom: 0.25rem;
    padding-bottom: 0;
  }
}

/* =========================================================
   Settings layout
   ========================================================= */
.settings-shell {
  min-height: 90vh;
}

.settings-pane {
  display: flex;
  flex-direction: column;
  min-height: 90vh;
  max-height: 90vh;
  background: #fff;
}

.settings-left,
.settings-right {
  overflow: hidden;
}

.settings-left-header,
.settings-right-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.settings-left-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.settings-right-content {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.settings-form {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
}

.settings-right-header {
  padding: 1rem 1.25rem;
}

.settings-right-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.settings-right-footer {
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: #fff;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  padding: 0.75rem 1.25rem;
  box-shadow: 0 -6px 14px rgba(15, 23, 42, 0.04);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.settings-item {
  border: none;
  border-left: 4px solid transparent;
  padding: 0.45rem 0.75rem 0.45rem 1.1rem;
  color: #0f172a;
}

.settings-item:hover {
  background: rgba(15, 23, 42, 0.04);
}

.settings-item.active {
  background: #fff;
  color: #0f172a;
  border-left-color: var(--brand-teal);
  font-weight: 600;
}

.settings-item.active:hover {
  background: #fff;
}

.settings-policy-group td {
  background: #f8fafc;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.settings-policy-table-wrap {
  max-height: 100%;
}

.settings-policy-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.08);
}

.notification-policy-info {
  display: grid;
  gap: 0.2rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 0.55rem;
  background: #f8fafc;
  color: #475569;
  font-size: 0.76rem;
  line-height: 1.3;
}

.notification-policy-info .bi {
  color: #334155;
}

.settings-policy-table .policy-check {
  width: 1.08rem;
  height: 1.08rem;
  margin: 0 auto;
  float: none;
  border-radius: 0.25rem;
  border: 1.4px solid #475569;
  background-color: #fff;
}

.settings-policy-table .policy-check:hover {
  border-color: #1f4a63;
}

.settings-policy-table .policy-check:checked {
  border-color: #1f4a63;
  background-color: #1f4a63;
}

.policy-lock-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  min-width: 3.4rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  user-select: none;
}

.policy-lock-pill .bi {
  font-size: 0.68rem;
}

.policy-lock-pill--on {
  color: #0f5132;
  border-color: #a3cfbb;
  background: #e7f8ef;
}

.policy-lock-pill--off {
  color: #475569;
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.policy-timing-select {
  max-width: 108px;
}

.policy-timing-offset {
  max-width: 116px;
}

.settings-provider-card {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 0.8rem;
  padding: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.form-action-bar {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 1030;
  background: #fff;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 -6px 14px rgba(15, 23, 42, 0.04);
  padding: 0.75rem 1.25rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
  transition: background var(--transition-duration) ease, color var(--transition-duration) ease;
}

.form-action-bar__row .dropdown-toggle::after {
  margin-left: 0.35rem;
}

.form-action-bar .dropdown-menu {
  min-width: 12rem;
}

.task-form.has-action-bar {
  padding-bottom: calc(var(--form-action-bar-clearance) + env(safe-area-inset-bottom)) !important;
}

.has-action-bar {
  padding-bottom: calc(var(--form-action-bar-clearance) + env(safe-area-inset-bottom)) !important;
}

/* Collection module (Follow-up): remove top gap under topbar while keeping sticky header behavior. */
.collection-followup-page.task-page {
  margin-top: 0 !important;
}

.collection-followup-page .followup-page-header {
  top: var(--topbar-height, 56px) !important;
}

html.sidebar-closed .form-action-bar {
  left: 0;
}

@media (max-width: 767.98px) {
  .form-action-bar {
    left: 0;
  }
}

[data-master-graph-field] {
  transition: opacity 0.16s ease;
}

[data-master-graph-field].master-step-locked {
  opacity: 0.72;
}

.char-counter-wrap .char-counter {
  position: absolute;
  right: 6px;
  bottom: 6px;
  font-size: 0.78rem;
  color: #6c757d;
  background: rgba(255, 255, 255, 0.85);
  padding: 0 6px;
  border-radius: 8px;
  pointer-events: none;
}

.char-counter-wrap .char-counter--warn {
  color: #b46900;
}

.char-counter-wrap .char-counter--error {
  color: #b42318;
}

#followupsTable .followup-remark-col {
  width: 60%;
}

#followupsTable td.followup-remark-col {
  white-space: normal;
  word-break: break-word;
}

/* PIT labor section desktop layout: 20% / 20% / 30% / 30% in one row */
@media (min-width: 992px) {
  .pit-labor-row > .pit-labor-col-20 {
    flex: 0 0 20%;
    max-width: 20%;
  }

  .pit-labor-row > .pit-labor-col-30 {
    flex: 0 0 30%;
    max-width: 30%;
  }
}
