@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --font-sans: 'Manrope', 'Inter', 'Segoe UI', 'Avenir Next', system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --bg: #f3f7fd;
  --surface: #ffffff;
  --surface-alt: #f8fbff;
  --ink: #11263b;
  --muted: #66798d;
  --line: #d9e5f2;
  --brand: #125fa3;
  --brand-2: #11808f;
  --accent: #0ea5a5;
  --danger: #cb3d52;
  --ok: #1a8f5a;
  --warning: #d68d26;
  --shadow: 0 10px 28px rgba(8, 26, 56, 0.10);
  --shadow-soft: 0 6px 16px rgba(18, 40, 80, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --space: 16px;
  --space-lg: 26px;
}

*,
*:before,
*:after { box-sizing: border-box; }

html,
body { margin: 0; width: 100%; }

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}

a { color: var(--brand); text-decoration: none; }

img { max-width: 100%; display: block; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.is-hidden { display:none !important; }

.app-body { min-height: 100vh; }

.container {
  width: auto;
  max-width: none;
  margin: 0 0 0 264px;
  padding: 20px 24px 42px;
  transition: margin-left .22s ease;
}

.page-head {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

.page-head h1 { margin: 0 0 6px; font-size: 34px; }
.page-head p { margin: 0; color: var(--muted); }

.h-stack,
.v-stack {
  display: grid;
  gap: var(--space);
}

.h-stack { grid-auto-flow: column; align-items: center; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: #fff;
  border-bottom: 1px solid #dbe5ee;
  box-shadow: 0 4px 14px rgba(8, 26, 56, 0.05);
  padding: 0 16px;
}

.topbar-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  min-height: 72px;
  margin-left: 272px;
  align-items: center;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  min-width: 0;
}
.brand img { width: 118px; height: 38px; object-fit: contain; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.menu-toggle-btn {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--brand);
  padding: 8px 10px;
  gap: 8px;
  align-items: center;
}

.quick-actions,
.userbox,
.topbar-main > .userbox,
.quick-actions { display: inline-flex; align-items: center; gap: 10px; }

.quick-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand);
  padding: 8px 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  white-space: nowrap;
}

.quick-link:hover,
.quick-link:focus-visible {
  border-color: color-mix(in srgb, var(--brand), transparent 40%);
  color: #0f4f88;
}

.quick-link-primary {
  background: #0b7089;
  border-color: #0b7089;
  color: #fff;
}
.quick-link-search {
  background: #eef9fb;
  border-color: #9ed4dc;
  color: #086f82;
  box-shadow: 0 3px 10px rgba(12, 113, 133, .08);
}
.quick-link-search:hover,
.quick-link-search:focus-visible { background: #e2f4f7; border-color: #5eb7c4; color: #075b6b; }

.quick-link-badge {
  display: inline-flex;
  min-width: 19px;
  height: 19px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--danger);
  font-size: 11px;
  font-weight: 700;
  padding: 0 5px;
}

.quick-link-alert.active {
  background: #f4faff;
}

.userbox {
  justify-self: end;
  text-align: right;
  min-width: 0;
}

.userbox-avatar,
.sidebar-profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0b7089;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  flex: 0 0 36px;
}

.userbox strong { display: block; font-size: 14px; }
.userbox-meta small { color: var(--muted); display: block; }

.userbox-logout {
  margin-left: 8px;
  color: #8b4b52;
}

.topbar-sub {
  position: fixed;
  top: 0;
  right: auto;
  bottom: 0;
  left: 0;
  z-index: 220;
  width: 264px;
  height: 100vh;
  min-height: 100vh;
  margin: 0;
  padding: 18px 12px;
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border-right: 1px solid #dbe5ee;
  box-shadow: 4px 0 18px rgba(17, 44, 72, .045);
  transition: width .22s ease, padding .22s ease;
  transform: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  margin: 0 0 16px;
  padding: 5px 8px;
  color: #153b58;
  font-size: 15px;
  font-weight: 700;
}

.sidebar-brand img { width: 118px; height: 38px; object-fit: contain; }
.sidebar-brand span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 0;
  color: #345f7e;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -.35px;
}

.sidebar-profile {
  display: flex;
  width: 100%;
  min-width: 0;
  margin-bottom: 20px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.sidebar-profile + .topnav {
  padding-top: 2px;
  border-top: 1px solid #e6eef3;
}

.sidebar-profile-meta small {
  color: var(--muted);
  display: block;
}

.topnav {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 6px;
  align-items: stretch;
}

.topnav > a,
.nav-group-toggle {
  border: 1px solid var(--line);
  width: 100%;
  min-height: 44px;
  justify-content: flex-start;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  padding: 8px 12px;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.nav-group-toggle > span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-group-toggle > .fa-chevron-down {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 10px;
}

.topnav > a > i,
.nav-group-toggle > span > i {
  width: 18px;
  flex: 0 0 18px;
  text-align: center;
  font-size: 14px;
  line-height: 1;
}

.topnav > a.active,
.nav-group.active > .nav-group-toggle {
  color: #0a617c;
  background: #eef6fa;
  border-color: #bfd8e4;
  border-left: 3px solid #0b7898;
}

.nav-group { position: static; }

.nav-group-menu {
  position: static;
  z-index: 30;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0 0 0 10px;
  margin: 3px 0 5px 10px;
  border-left: 1px solid #d9e6ed;
  display: none;
}

.nav-group.open .nav-group-menu { display: grid; gap: 6px; }

.nav-group-menu a {
  min-height: 36px;
  border-radius: 6px;
  color: #50687a;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  display: grid;
  gap: 0;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-group-menu a > i {
  width: 18px;
  text-align: center;
  font-size: 13px;
}

.nav-group-menu a:hover,
.nav-group-menu a.active {
  background: #f0f6f9;
  color: #0b6c86;
}

.nav-group-hint {
  color: var(--muted);
  font-size: 12px;
  padding: 6px 8px;
  display: block;
}

.portal-sidebar-collapsed .topbar-main { margin-left: 84px; }
.portal-sidebar-collapsed .topbar-sub { width: 76px; padding-left: 10px; padding-right: 10px; }
.portal-sidebar-collapsed .topbar-sub { overflow-x: visible; overflow-y: auto; }
.portal-sidebar-collapsed .container { margin-left: 76px; }
.portal-sidebar-collapsed .sidebar-profile-meta,
.portal-sidebar-collapsed .nav-group-menu { display: none; }
.portal-sidebar-collapsed .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }
.portal-sidebar-collapsed .sidebar-brand img { width: 38px; }
.portal-sidebar-collapsed .sidebar-brand span { display: none; }
.portal-sidebar-collapsed .sidebar-profile {
  min-width: 0;
  width: 100%;
  justify-content: center;
  margin-bottom: 14px;
  padding: 8px 0;
  border: 0;
  background: transparent;
}
.portal-sidebar-collapsed .sidebar-profile-avatar { width: 32px; height: 32px; flex-basis: 32px; }
.portal-sidebar-collapsed .nav-group-toggle > span { font-size: 0; }
.portal-sidebar-collapsed .topnav > a,
.portal-sidebar-collapsed .nav-group-toggle { justify-content: center; padding-left: 0; padding-right: 0; }
.portal-sidebar-collapsed .topnav > a { font-size: 0; }
.portal-sidebar-collapsed .topnav > a > i,
.portal-sidebar-collapsed .nav-group-toggle > span > i { font-size: 15px; }
.portal-sidebar-collapsed .nav-group-toggle > .fa-chevron-down { display: none; }
.portal-sidebar-collapsed .nav-group { position: relative; }
.portal-sidebar-collapsed .nav-group.open .nav-group-menu {
  position: absolute;
  top: 0;
  left: calc(100% + 9px);
  z-index: 100;
  width: 224px;
  margin: 0;
  padding: 6px;
  border: 1px solid #d6e3eb;
  border-left: 3px solid #0b7898;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(17, 44, 72, .16);
}

@media (min-width: 901px) {
  .topbar-sub {
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
    transform:none !important;
  }
  .menu-toggle-btn {
    position: fixed;
    left: 264px;
    top: 50%;
    z-index: 230;
    width: 32px;
    height: 84px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid #cbdde8;
    border-left: 0;
    border-radius: 0 12px 12px 0;
    background: #eaf3f8;
    color: #37647e;
    box-shadow: 3px 4px 12px rgba(29, 66, 93, .10);
    transform: translateY(-50%);
  }

  .topbar-main {
    grid-template-columns: minmax(0, 1fr) auto auto;
    margin-left: 264px;
    padding: 0 28px;
  }

  .menu-toggle-btn span,
  .menu-toggle-btn .menu-toggle-bars { display: none; }
  .menu-toggle-btn .menu-toggle-chevron { display: block; font-size: 13px; }
  .portal-sidebar-collapsed .menu-toggle-btn { left: 76px; }
  .portal-sidebar-collapsed .menu-toggle-btn .menu-toggle-chevron { transform: rotate(180deg); }
}

.top-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(12, 24, 44, 0.5);
}

.top-modal.active,
.od-modal-overlay.active { display: flex; }

.top-modal-card,
.od-modal-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  width: min(940px, calc(100% - 36px));
  max-height: 90vh;
  overflow: auto;
  padding: 14px;
  box-shadow: var(--shadow);
}

.top-modal-head,
.od-modal-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.top-modal-head h2,
.od-modal-head h2 { margin: 0; }

.od-table-wrap,
.top-search-result,
.table-wrap {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: auto;
}

.table-wrap,
.case-table-wrap,
.case-admin-table-card { margin-top: 10px; }

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 11px 10px;
  font-size: 13px;
  vertical-align: top;
}

th { color: var(--muted); font-weight: 700; font-size: 12px; letter-spacing: .02em; text-transform: uppercase; }

.table-fit,
.management-table-wrap table,
.portal-datatable-scroll table,
table.dataTable {
  width:100% !important;
  min-width:0;
  table-layout:auto;
}
.table-fit col,
.portal-datatable-scroll table:not([data-dt-use-widths="true"]) col,
.management-table-wrap table:not([data-dt-use-widths="true"]) col {
  width:auto !important;
}
.management-table-wrap,
.portal-datatable-scroll,
.dataTables_wrapper {
  width:100%;
  max-width:100%;
  min-width:0;
}
.management-table-wrap,
.portal-datatable-scroll {
  overflow-x:auto;
  overflow-y:visible;
  -webkit-overflow-scrolling:touch;
}
.management-table-wrap th,
.management-table-wrap td,
.portal-datatable-scroll th,
.portal-datatable-scroll td,
table.dataTable th,
table.dataTable td {
  max-width:clamp(110px, 18vw, 340px);
  white-space:normal;
  overflow-wrap:anywhere;
  word-break:normal;
}
.management-table-wrap th:last-child,
.management-table-wrap td:last-child,
.portal-datatable-scroll th:last-child,
.portal-datatable-scroll td:last-child,
table.dataTable th:last-child,
table.dataTable td:last-child {
  width:1%;
  max-width:none;
  white-space:nowrap;
}
.management-table-wrap .action-wrap,
.portal-datatable-scroll .action-wrap {
  min-width:max-content;
}
.portal-datatable-toolbar {
  position:relative;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  margin:0 0 10px;
  min-height:40px;
  z-index:5;
  order:0;
  grid-column:1 / -1;
  justify-self:stretch;
}
.portal-datatable-columns-btn,
.portal-datatable-columns-reset {
  min-height:36px;
  padding:7px 11px;
}
.portal-datatable-columns-panel {
  position:absolute;
  top:calc(100% + 8px);
  right:0;
  width:min(360px, calc(100vw - 36px));
  max-height:min(460px, 70vh);
  display:none;
  gap:6px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
  box-shadow:0 18px 40px rgba(17,44,72,.16);
  overflow:auto;
}
.portal-datatable-columns-panel.active {
  display:grid;
}
.portal-datatable-columns-item {
  display:grid;
  grid-template-columns:18px minmax(0,1fr);
  align-items:center;
  gap:8px;
  min-height:38px;
  padding:6px 8px;
  border:1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius:8px;
  background:var(--surface-alt);
  color:var(--ink);
  font-size:12px;
  font-weight:700;
}
.portal-datatable-columns-item:has(.portal-datatable-columns-width) {
  grid-template-columns:18px minmax(0,1fr) 78px;
}
.portal-datatable-columns-title {
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.portal-datatable-columns-width {
  width:78px;
  min-height:30px;
  padding:5px 7px;
  font-size:12px;
}
.portal-datatable-columns-item input[type="checkbox"] {
  width:16px;
  height:16px;
  accent-color:var(--brand-2);
}
.dataTables_wrapper {
  display:block;
  width:100%;
  max-width:100%;
  min-width:0;
  overflow:visible;
}
.dataTables_wrapper::after {
  content:"";
  display:block;
  clear:both;
}
.portal-dt-shell {
  display:grid;
  gap:12px;
  width:100%;
  min-width:0;
}
.portal-dt-toolbar,
.portal-dt-footer {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  width:100%;
  min-width:0;
}
.portal-dt-toolbar {
  min-height:54px;
  padding:9px 12px;
  border:1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius:12px;
  background:linear-gradient(180deg, #fbfdff 0%, #f6fbfd 100%);
}
.portal-dt-footer {
  min-height:48px;
  padding:10px 2px 0;
  border-top:1px solid color-mix(in srgb, var(--line) 86%, transparent);
}
.portal-dt-length,
.portal-dt-filter,
.portal-dt-info,
.portal-dt-pager {
  min-width:0;
}
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  float:none;
  margin:0;
  color:var(--muted);
  font-size:12px;
  font-weight:800;
  width:auto;
}
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin:0;
  white-space:nowrap;
}
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  min-height:38px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface);
  color:var(--ink);
  box-shadow:0 1px 0 rgba(17,44,72,.03);
}
.dataTables_wrapper .dataTables_length select {
  min-width:76px;
  padding:7px 30px 7px 12px;
}
.dataTables_wrapper .dataTables_filter input {
  width:min(340px, 36vw);
  max-width:100%;
  margin:0;
  padding:9px 14px;
  outline:none;
}
.dataTables_wrapper .dataTables_filter input:focus {
  border-color:#8bcbd5;
  box-shadow:0 0 0 4px rgba(19,138,155,.12);
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  float:none;
  padding:0;
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  display:inline-flex !important;
  align-items:center;
  justify-content:center;
  min-width:34px;
  min-height:34px;
  border:1px solid var(--line) !important;
  border-radius:999px !important;
  padding:6px 11px !important;
  margin-left:5px !important;
  background:var(--surface) !important;
  color:var(--brand) !important;
  font-weight:800;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  border-color:#8bcbd5 !important;
  background:#eef9fb !important;
  color:#075b6b !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  opacity:.56;
  color:var(--muted) !important;
}
.portal-datatable-scroll {
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
}
table.dataTable {
  margin:0 !important;
  border-collapse:separate;
  border-spacing:0;
}
table.dataTable thead th,
table.dataTable thead td {
  padding:13px 14px;
  border-bottom:1px solid var(--line) !important;
  background:#f7fbfd;
  color:#6c7f95;
  font-size:12px;
  font-weight:900;
  letter-spacing:0;
  text-transform:uppercase;
}
table.dataTable tbody td {
  padding:14px;
  border-bottom:1px solid color-mix(in srgb, var(--line) 82%, transparent);
  color:var(--ink);
  font-size:13px;
  vertical-align:middle;
}
table.dataTable tbody tr {
  background:var(--surface);
}
table.dataTable tbody tr:nth-child(even) {
  background:#fbfdff;
}
table.dataTable tbody tr:hover {
  background:#eef9fb;
}
table.dataTable.no-footer {
  border-bottom:0;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.card h2,
.card h3 { margin: 0 0 8px; }

.cards {
  display: grid;
  gap: var(--space);
}

.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.grid { display: grid; gap: var(--space); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

label { display: grid; gap: 6px; font-size: 13px; color: #506174; }

input,
select,
textarea,
button,
.btn {
  font: inherit;
}

.field,
.input-wrap {
  display: grid;
  gap: 8px;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--ink);
  min-height: 44px;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--brand), #fff 35%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand), transparent 80%);
  background: #fbfdff;
}

textarea { min-height: 110px; resize: vertical; }

.btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 38px;
  padding: 8px 12px;
  cursor: pointer;
  background: #fff;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: border-color .2s ease, color .2s ease, background .2s ease, box-shadow .2s ease;
}

.btn:hover,
.btn:focus-visible {
  border-color: color-mix(in srgb, var(--brand), transparent 40%);
  color: #0f4f88;
  outline: none;
}

.btn-primary {
  background: #0b7089;
  border-color: #0b7089;
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background:#0b7089;
  border-color:#0b7089;
  color:#fff;
  box-shadow:0 3px 10px rgba(12, 113, 133, .08);
}

.btn-ghost { background: #fff; }
.btn-danger { border-color: color-mix(in srgb, var(--danger), #fff 40%); color: var(--danger); }
.btn-danger:hover,
.btn-danger:focus-visible,
.activity-icon-btn.danger:hover,
.activity-icon-btn.danger:focus-visible {
  border-color:color-mix(in srgb, var(--danger), transparent 40%);
  color:var(--danger);
}
.btn-warning { border-color: color-mix(in srgb, var(--warning), #fff 40%); color: #9d5d00; }

.btn-sm { min-height: 32px; padding: 6px 10px; font-size: 12px; border-radius: 999px; }

.btn .fa-solid,
.btn .fa-regular,
.btn .fa-brands { width: 1em; text-align: center; }

.alert {
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 14px;
}

.alert-error { background: #fff1f4; color: #7a2435; border: 1px solid #ffd2d8; }
.alert-ok { background: #e8f8f1; color: #145f3e; border: 1px solid #9de5c3; }

.toast-stack {
  position: fixed;
  right: 16px;
  top: 16px;
  z-index: 2400;
  width: min(340px, calc(100% - 24px));
  display: grid;
  gap: 10px;
}

.toast {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 4px;
  animation: toast-in .25s ease both;
  position: relative;
  padding-right: 34px;
}

.toast.success { border-left: 5px solid var(--ok); }
.toast.error { border-left: 5px solid var(--danger); }
.toast.warning { border-left: 5px solid var(--warning); }

.toast-close {
  position: absolute;
  right: 8px;
  top: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate3d(0, -6px, 0); }
  to { opacity: 1; transform: none; }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1;
}

.badge-soft {
  background: var(--surface-alt);
  color: #29506d;
}

.checkbox-list,
.form-actions,
.action-row { display: inline-flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.switch {
  --track: color-mix(in srgb, var(--brand), #fff 75%);
  --thumb: #fff;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--muted);
  user-select: none;
}

.switch input { position: absolute; opacity: 0; pointer-events: none; }

.switch .track {
  width: 42px;
  height: 24px;
  background: #d9e4f1;
  border: 1px solid #d2deec;
  border-radius: 999px;
  position: relative;
  transition: .2s ease;
}

.switch .track::after {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--thumb);
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform .2s ease;
  box-shadow: 0 1px 4px rgba(8, 26, 56, 0.16);
}

.switch input:checked + .track { background: var(--accent); border-color: color-mix(in srgb, var(--accent), #fff 28%); }
.switch input:checked + .track::after { transform: translateX(18px); }

.pill {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 3px 8px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill .btn-sm { margin-left: 6px; }

.pager {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.activity-form-grid,
.hybrid-inline,
.input-with-actions,
.suggest-inline { display: grid; gap: 12px; }

.activity-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.activity-form-row {
  display: grid;
  grid-template-columns: minmax(170px, 220px) 1fr;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  min-height: 48px;
}

.activity-form-row > .label-cell {
  background: #eef3f9;
  color: #2f4760;
  font-weight: 600;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-right: 1px solid #dbe5f0;
}

.activity-form-row > .input-cell {
  display: grid;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}

.activity-form-row input,
.activity-form-row select,
.activity-form-row textarea {
  border: 1px solid #d7e3f0;
}

.case-admin-kpi-strip,
.case-kpi-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }

.case-kpi,
.card.stat { min-height: 100px; background: var(--surface); }

.case-admin-table th { background: #f8fbff; font-size: 12px; }
.case-admin-table td { vertical-align: top; }

.case-admin-table tbody tr:hover td,
.data-grid tbody tr:hover td { background: #f8fbff; }

.admin-subnav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 16px;
}
.admin-subnav a {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 14px;
  color: var(--ink);
  background: #fff;
}

.admin-subnav a.active {
  color: #fff;
  border-color: transparent;
  background: #0b7089;
}

.admin-grid-link { display: grid; gap: 8px; color: var(--ink); min-height: 132px; }
.admin-grid-link strong { font-size: 18px; }
.admin-grid-link span { color: var(--muted); line-height: 1.45; }
.admin-grid-link small { color: var(--brand); font-weight: 700; }

.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-muted { color: var(--muted); }

.inline-setting-value {
  display: inline-block;
  min-width: 220px;
  padding: 6px 8px;
  border: 1px dashed #9bb0c8;
  border-radius: 8px;
  background: #f8fbff;
}

.inline-setting-value:focus {
  outline: none;
  border-color: #0b5cab;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(11, 92, 171, 0.12);
}

.setting-actions {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 9px;
  cursor: pointer;
  font-size: 13px;
}

.icon-btn:hover { border-color: #0b5cab; color: #0b5cab; }
.danger-btn:hover { border-color: #cf304a; color: #cf304a; }

.login-page { min-height: 100vh; margin: 0; background: #fff; }

.login-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
}

.login-brand {
  position: relative;
  min-height: 100vh;
  height: min(100vh, 100dvh);
  padding: clamp(24px, 3.6vw, 48px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  box-sizing: border-box;
  color: #fff;
  background:
    radial-gradient(circle at 76% 14%, rgba(96, 213, 218, 0.28), transparent 28%),
    linear-gradient(145deg, #0a4f8f 0%, #0a78a1 55%, #0a968f 100%);
}

.login-brand::after {
  content: '';
  position: absolute;
  width: 360px;
  height: 360px;
  right: -182px;
  bottom: -182px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .15);
  pointer-events: none;
}

.login-wordmark,
.login-mobile-wordmark {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px 10px 12px;
  color: #143550;
  background: rgba(255, 255, 255, .98);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 15px;
  box-shadow: 0 14px 34px rgba(0, 31, 58, .18);
}

.login-logo-frame {
  width: 154px;
  height: 48px;
  display: grid;
  place-items: center;
  padding: 3px 5px;
  overflow: hidden;
  background: transparent;
}

.brand-logo { width: 100%; height: 100%; object-fit: contain; }

.pulse-word { padding-left: 16px; color: #345f7e; border-left: 1px solid #cfd9e3; font-size: 32px; font-weight: 350; letter-spacing: -1.1px; }

.login-brand-copy { max-width: 600px; margin: 0; }
.login-brand-core {
  display: grid;
  align-content: center;
  gap: 24px;
  min-height: 0;
}

.login-brand h1 { margin: 0 0 18px; font-size: clamp(40px, 4.6vw, 68px); line-height: 1.04; }
.login-brand h1 span { color: #97ece8; }
.login-brand p { color: rgba(255,255,255,.86); max-width: 56ch; margin: 0; font-size: 18px; line-height: 1.62; }

.login-eyebrow {
  display: block;
  margin-bottom: 18px;
  color: #b4eeec;
  letter-spacing: .005em;
  text-transform: none;
  font-size: clamp(22px, 2.1vw, 30px);
  font-weight: 700;
}

.login-trust {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 500px;
  margin-bottom: 30px;
  color: rgba(255,255,255,.85);
}

.login-brand-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  color: rgba(255,255,255,.66);
  font-size: 12px;
}

.login-brand-footer a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

.login-card {
  background: #fff;
  padding: 48px clamp(28px, 8vw, 120px);
  display: grid;
  align-items: center;
}

.login-card-inner { width: min(560px, 100%); margin: 0 auto; position: relative; }

.login-mobile-wordmark { display: none; margin: 0 0 28px; }

.language-switcher {
  position: absolute;
  top: -22px;
  right: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: #edf3f6;
  border-radius: 999px;
}

.language-switcher a {
  min-width: 34px;
  text-align: center;
  padding: 6px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  color: #60788c;
}

.language-switcher a.active {
  color: #fff;
  background: #087589;
  box-shadow: 0 3px 9px rgba(8, 92, 111, .18);
}

.login-heading { margin-bottom: 26px; }
.login-heading h2 { margin: 0 0 8px; font-size: clamp(30px, 3.2vw, 43px); }
.login-heading .login-eyebrow { color: #087d88; }

.login-alert {
  margin-bottom: 18px;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff1f3;
  border: 1px solid #ffd2d8;
  color: #9d2938;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
}

.login-alert svg,
.password-toggle svg,
.login-trust svg {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.password-toggle svg {
  width: 22px;
  height: 22px;
}

.login-alert svg,
.login-trust svg {
  stroke: currentColor;
  fill: none;
}

.social-login-list { display: grid; gap: 10px; }
.social-login-btn {
  width: 100%;
  min-height: 56px;
  border-radius: 13px;
  background: #fff;
  border: 1px solid #cbd6df;
  padding: 0 18px;
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  gap: 12px;
  color: #18364f;
  font-weight: 600;
  text-align: left;
  transition: .2s ease;
}

.social-login-btn:hover {
  border-color: #68a8c6;
  box-shadow: 0 8px 22px rgba(17, 67, 101, .09);
}

.provider-icon { width: 23px; height: 23px; }
.button-arrow { color: #7890a2; font-size: 16px; text-align: right; width: 16px; text-align: right; }

.login-divider {
  margin: 24px 0 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: #718391;
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 650;
  letter-spacing: .06em;
}

.login-divider::before,
.login-divider::after { content: ""; height: 1px; flex: 1; background: #e2e8ed; }

.register-actions { display: grid; gap: 10px; }

.register-btn {
  min-height: 68px;
  padding: 12px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid #b9c9d4;
  border-radius: 13px;
  color: #17364e;
  transition: .2s ease;
  background: #fff;
}

.register-btn:hover {
  border-color: #5d9fbd;
  background: #f7fbfc;
}

.register-btn-primary {
  background: #0b7089;
  border-color: #0b7089;
  color: #fff;
}

.register-btn strong { margin-bottom: 3px; font-size: 14px; display: block; }
.register-btn small { opacity: .76; font-size: 12px; font-weight: 400; line-height: 1.35; }

.login-consent {
  margin: 19px 0 0;
  color: #84929d;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.login-consent a { color: #536d7e; }

.manual-login-panel { margin-top: 16px; padding: 0 14px; border: 1px dashed #b8c9d5; border-radius: 12px; }
.manual-login-panel summary { padding: 12px 0; color: #526b7c; cursor: pointer; font-size: 13px; }

.manual-login-form { padding: 2px 0 15px; display: grid; gap: 7px; }
.manual-login-form input:not([type="hidden"]) { width: 100%; }
.manual-login-form > input,
.password-field input { min-height: 45px; border-radius: 9px; }

.password-field { position: relative; width: 100%; min-width: 0; }

.password-field input {
  width: 100%;
  display: block;
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 45px;
  height: 45px;
  margin: 0;
  border: 0;
  background: transparent;
  color: #5e7383;
  display: grid;
  place-items: center;
}

.primary-login-btn {
  min-height: 46px;
  margin-top: 8px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: #075e91;
}

.login-shell.registration-login-shell { grid-template-columns: 1fr; min-height: 100vh; }

.registration-page { min-height: 100vh; margin: 0; color: #17364e; background: #eef5f7; }

.registration-shell { width: min(1120px, calc(100% - 36px)); margin: 0 auto; padding: 28px 0 60px; }

.registration-header {
  min-height: 52px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
}

.registration-wordmark {
  display: inline-flex;
  justify-self: start;
}

.registration-language { justify-self: end; position: relative; top: 0; }

.registration-card {
  margin-top: 26px;
  border-radius: 16px;
  border: 1px solid #d7e3f2;
  background: #fff;
  padding: clamp(22px, 4vw, 46px);
}

.registration-layout {
  display: grid;
  gap: 12px;
}

.registration-alert {
  margin-bottom: 14px;
  border: 1px dashed #c2dae8;
  background: #f8fcff;
}

.registration-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.registration-grid .wide { grid-column: 1 / -1; }

.login-mobile-wordmark { display: none; }

.template-shell {
  margin-top: 22px;
  display: grid;
  gap: var(--space-lg);
}

.template-surface {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.template-grid { display: grid; gap: var(--space); grid-template-columns: repeat(3, minmax(0, 1fr)); }

.template-section-title { margin: 0 0 10px; font-size: 19px; }

.data-grid { width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.data-grid th,
.data-grid td { border-bottom: 1px solid var(--line); }
.data-grid thead th { background: #f8fbff; }

.menu-stack {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.menu-chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 13px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #35495f;
  cursor: pointer;
}

.checkbox input {
  width: 18px;
  height: 18px;
}

.switch-control {
  display:inline-flex;
  align-items:center;
  gap:9px;
  min-height:34px;
  color:var(--muted);
  font-size:13px;
  font-weight:800;
  line-height:1.2;
  cursor:pointer;
  user-select:none;
}
.switch-control input[type="checkbox"] {
  position:absolute;
  width:1px;
  height:1px;
  opacity:0;
  pointer-events:none;
}
.switch-control-slider {
  position:relative;
  width:42px;
  height:24px;
  flex:0 0 auto;
  border:1px solid #c8d9e8;
  border-radius:999px;
  background:#eaf1f7;
  transition:background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.switch-control-slider::after {
  content:"";
  position:absolute;
  top:3px;
  left:3px;
  width:16px;
  height:16px;
  border-radius:999px;
  background:#fff;
  box-shadow:0 2px 7px rgba(17,44,72,.18);
  transition:transform .18s ease;
}
.switch-control input[type="checkbox"]:checked + .switch-control-slider {
  border-color:#87cbd4;
  background:var(--brand-2);
}
.switch-control input[type="checkbox"]:checked + .switch-control-slider::after {
  transform:translateX(18px);
}
.switch-control input[type="checkbox"]:focus-visible + .switch-control-slider {
  box-shadow:0 0 0 4px rgba(19,138,155,.14);
}
.switch-control-label {
  white-space:nowrap;
}

@media (max-width: 1200px) {
  .cards.four,
  .template-grid,
  .case-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .template-shell { grid-template-columns: 1fr; }
  .topbar-main { grid-template-columns: auto minmax(0, 1fr) auto auto; margin-left: 264px; gap:8px; }
  .quick-actions { min-width:0; overflow:hidden; gap:6px; }
  .quick-actions .quick-link { padding-left:8px; padding-right:8px; font-size:12px; }
  .tenant-switcher { min-width:145px; }
  .sidebar-profile { display: flex; }
  .userbox strong { font-size: 13px; }
}

@media (max-width: 900px) {
  .topbar-main { grid-template-columns: auto minmax(0, 1fr) auto; min-height: 64px; margin-left: 0; }
  .quick-actions { grid-column: 1 / -1; grid-row: 2; display: flex; width: 100%; min-width: 0; overflow-x: auto; padding: 0 0 8px; gap: 6px; }
  .topbar-main > .userbox { grid-column: 3; grid-row: 1; }
  .tenant-switcher { grid-column: 1 / -1; grid-row: 3; width:100%; }
  .quick-actions .quick-link { min-height: 34px; padding: 6px 9px; font-size: 12px; }
  .menu-toggle-btn { display: inline-flex; }
  .menu-toggle-btn { position: static; width: auto; height: auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; transform: none; box-shadow: none; }
  .menu-toggle-btn .menu-toggle-bars { display: block; }
  .menu-toggle-btn .menu-toggle-chevron { display: none; }
  .menu-toggle-btn span { display: inline; }
  .topbar-sub {
    width: min(310px, calc(100% - 44px));
    height: 100dvh;
    min-height: 100dvh;
    padding: 78px 14px 20px;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 12px 0 28px rgba(17, 44, 72, .12);
  }
  .topbar-sub.mobile-open { transform: translateX(0); }
  .topnav { grid-template-columns: 1fr; }
  .sidebar-profile { gap: 10px; width: 100%; }
  .container { width: calc(100% - 20px); margin-left: 0; padding: 16px 0 36px; }
  .cards.three,
  .cards.four,
  .grid.three,
  .grid.two,
  .registration-grid,
  .activity-form-grid,
  .template-grid,
  .case-kpi-strip,
  .case-admin-filter-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .container { width: calc(100% - 20px); }
  .login-shell { grid-template-columns: 1fr; min-height: 100vh; }
  .login-brand { display: none; }
  .login-card { padding: 36px 16px; }
  .login-mobile-wordmark {
    display: inline-flex;
    margin-bottom: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* Management role and permission workspace. */
.management-page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:14px; }
.management-head-actions { display:flex; align-items:center; justify-content:flex-end; gap:10px; flex-wrap:wrap; }
.management-page-head h1 { margin-bottom:4px; }
.eyebrow { margin:0 0 4px; color:var(--brand-2); font-size:11px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
.management-scope-pill, .management-editable, .management-readonly { display:inline-flex; align-items:center; gap:7px; border:1px solid var(--line); border-radius:999px; padding:7px 11px; color:var(--muted); background:var(--surface-alt); font-size:12px; white-space:nowrap; }
.management-editable { color:#0a7182; border-color:#9bd2db; background:#effbfc; }
.management-role-layout { display:grid; grid-template-columns:minmax(220px,280px) minmax(0,1fr); gap:16px; align-items:start; }
.management-role-list, .management-role-panel { min-width:0; }
.management-panel-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.management-panel-heading h2 { margin:0 0 4px; font-size:19px; }
.management-panel-heading p { margin:0; color:var(--muted); font-size:13px; }
.management-role-tabs { display:grid; gap:7px; margin-top:16px; }
.management-role-tab { display:flex; align-items:center; justify-content:space-between; gap:10px; width:100%; padding:11px 12px; border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--ink); text-align:left; cursor:pointer; }
.management-role-tab:hover, .management-role-tab.active { border-color:#8bcbd5; background:var(--surface-alt); color:var(--brand); }
.management-role-tab strong, .management-role-tab small { display:block; }
.management-role-tab small { margin-top:3px; color:var(--muted); font-size:11px; }
.management-role-panels { min-width:0; }
.management-role-panel { display:none; }
.management-role-panel.active { display:block; }
.management-permission-groups { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin-top:18px; }
.management-permission-group { min-width:0; margin:0; padding:12px; border:1px solid var(--line); border-radius:12px; background:var(--surface-alt); }
.management-permission-group legend, .management-permission-group h3 { padding:0 4px; margin:0 0 9px; color:var(--ink); font-size:13px; font-weight:800; }
.management-permission-item { display:flex; align-items:flex-start; gap:9px; padding:8px 4px; border-top:1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.management-permission-item:first-of-type { border-top:0; }
.management-permission-item input { margin-top:3px; accent-color:var(--brand-2); }
.management-permission-item > i { width:16px; margin-top:2px; color:var(--brand-2); text-align:center; }
.management-permission-item strong, .management-permission-item small { display:block; }
.management-permission-item strong { color:var(--ink); font-size:13px; }
.management-permission-item small { margin-top:2px; color:var(--muted); font-size:11px; }
.management-form-actions { display:flex; justify-content:flex-end; margin-top:16px; }
.management-table-card { padding: clamp(16px, 2vw, 22px); }
.tenant-switcher { display:flex; align-items:center; gap:7px; min-width:170px; padding:4px 8px; border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--brand); }
.tenant-switcher label { display:inline-flex; align-items:center; color:var(--brand-2); }
.tenant-switcher select { min-width:0; width:100%; min-height:30px; border:0; padding:4px 2px; background:transparent; color:var(--ink); font-size:12px; font-weight:700; box-shadow:none; }
.tenant-switcher select:focus { outline:0; box-shadow:none; }
body.theme-dark .tenant-switcher { background:var(--surface); border-color:var(--line); }
.management-table-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; margin-bottom:14px; }
.management-table-head h2 { margin:0 0 4px; }
.management-table-head .meta { margin:0; }
.management-table-wrap { overflow-x:auto; overflow-y:visible; border:1px solid var(--line); border-radius:12px; background:var(--surface); }
.management-table-wrap table { margin:0; }
.management-table-wrap th { background:var(--surface-alt); }
.management-table-wrap tbody tr:last-child td { border-bottom:0; }
.admin-org-table label { display:grid; gap:4px; margin-bottom:8px; color:var(--muted); font-size:11px; font-weight:700; }
.admin-org-table label:last-child { margin-bottom:0; }
.admin-org-table input[type="text"], .admin-org-table select { width:100%; min-width:140px; min-height:36px; }
.admin-org-table td > small { color:var(--muted); font-size:11px; }
.admin-org-table input[type="checkbox"] { width:16px; height:16px; accent-color:var(--brand-2); }
body.theme-dark .management-editable { background:#173f49; border-color:#3b7f8b; color:#bcecf2; }
@media (max-width: 760px) {
  .management-page-head { display:grid; }
  .management-table-head { display:grid; }
  .management-role-layout { grid-template-columns:1fr; }
  .management-permission-groups { grid-template-columns:1fr; }
}

/* Master Admin portal */
.master-admin-body { background:#eef4fa; }
.master-sidebar {
  position:fixed;
  inset:0 auto 0 0;
  width:248px;
  display:flex;
  flex-direction:column;
  gap:18px;
  padding:18px 14px;
  border-right:1px solid var(--line);
  background:var(--surface);
  box-shadow:4px 0 18px rgba(8,26,56,.06);
  z-index:70;
}
.master-brand { display:grid; gap:8px; padding:8px 10px 14px; color:var(--ink); border-bottom:1px solid var(--line); }
.master-brand img { width:128px; height:auto; }
.master-brand span { font-weight:800; letter-spacing:.02em; }
.master-nav { display:grid; gap:7px; }
.master-nav a, .master-sidebar-footer a {
  display:flex;
  align-items:center;
  gap:10px;
  min-height:42px;
  padding:10px 12px;
  border-radius:10px;
  color:var(--ink);
  font-weight:700;
}
.master-nav a i, .master-sidebar-footer a i { width:18px; text-align:center; color:var(--brand-2); }
.master-nav a:hover, .master-nav a.active { background:#edf7fb; color:var(--brand); }
.master-sidebar-footer { margin-top:auto; padding-top:12px; border-top:1px solid var(--line); }
.master-topbar {
  position:sticky;
  top:0;
  z-index:60;
  min-height:72px;
  margin-left:248px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:12px 24px;
  border-bottom:1px solid var(--line);
  background:rgba(255,255,255,.94);
  backdrop-filter:blur(10px);
}
.master-topbar strong { font-size:18px; }
.master-container {
  margin-left:248px;
  padding:22px 24px 44px;
}
.master-kpi-grid {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin:16px 0;
}
.master-grid.two {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
  margin:16px 0;
}
.master-ops-strip {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-top:16px;
}
.master-ops-strip h2 { margin:0 0 4px; }
.master-ops-strip p { margin:0; color:var(--muted); }
.master-log-card pre {
  max-height:420px;
  overflow:auto;
  margin:0;
  padding:14px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#0f1f2f;
  color:#dbeafe;
  font-size:12px;
  line-height:1.55;
  white-space:pre-wrap;
}
.master-admin-link { border-color:#acd7de; background:#effbfc; }
body.theme-dark .master-sidebar,
body.theme-dark .master-topbar { background:var(--surface); border-color:var(--line); }
body.theme-dark.master-admin-body { background:var(--bg); }
@media (max-width: 980px) {
  .master-sidebar { position:static; width:auto; flex-direction:row; align-items:center; overflow:auto; }
  .master-brand { min-width:170px; border-bottom:0; border-right:1px solid var(--line); }
  .master-nav { display:flex; min-width:max-content; }
  .master-sidebar-footer { margin-top:0; margin-left:auto; padding-top:0; border-top:0; }
  .master-topbar, .master-container { margin-left:0; }
  .master-kpi-grid, .master-grid.two { grid-template-columns:1fr 1fr; }
}
@media (max-width: 700px) {
  .master-topbar { align-items:flex-start; flex-direction:column; }
  .master-kpi-grid, .master-grid.two { grid-template-columns:1fr; }
  .master-ops-strip { display:grid; }
}

.management-new-role-form { display:grid; gap:8px; margin:16px 0; padding:12px; border:1px solid var(--line); border-radius:11px; background:var(--surface-alt); }
.management-new-role-form label { display:grid; gap:4px; color:var(--muted); font-size:11px; font-weight:700; }
.management-new-role-form input { min-height:34px; padding:7px 9px; font-size:12px; }
.management-new-role-form .btn { width:100%; }
.management-new-role-modal { width:min(520px, 100%); }
.management-new-role-modal .management-form-actions .btn { width:auto; }
.management-unit-modal { width:min(620px, 100%); }
.management-unit-modal .management-form-actions .btn { width:auto; }
.management-filter-card { margin-bottom:14px; }
.management-count-badge { display:inline-flex; align-items:center; padding:8px 12px; border-radius:999px; color:#07558f; background:#eaf6fb; font-size:12px; font-weight:800; white-space:nowrap; }
.settings-readonly-card code { display:inline-block; max-width:520px; overflow-wrap:anywhere; color:var(--muted); font-family:ui-monospace,SFMono-Regular,Consolas,monospace; font-size:12px; }
.settings-form { margin-top:18px; }
.settings-form label { display:grid; gap:6px; color:var(--muted); font-size:12px; font-weight:700; }
.field-help { color:var(--muted); font-size:11px; font-weight:500; }
.registration-admin-table { margin-bottom:16px; overflow:visible; }
.registration-admin-table table { min-width:0; }
.registration-admin-table .management-table-wrap { overflow:auto; }
.registration-admin-user { display:grid; gap:3px; }
.registration-admin-user small { color:var(--muted); }
.registration-status { display:inline-flex; padding:5px 9px; border-radius:999px; font-size:12px; font-weight:800; text-transform:capitalize; }
.registration-status.pending { color:#8a5a00; background:#fff5d6; }
.registration-status.approved, .registration-status.active { color:#08734f; background:#dcf8ec; }
.registration-status.rejected, .registration-status.suspended { color:#a12c3c; background:#ffe7eb; }
.registration-actions { display:flex; gap:7px; justify-content:flex-end; }
.registration-actions form { margin:0; }
body.theme-dark .management-count-badge { color:#bcecf2; background:#173f49; }
@media (max-width:760px) { .registration-admin-table .management-table-head { display:grid; } .registration-actions { justify-content:flex-start; } }

/* Timeline workspace */
.timeline-page-head { margin-bottom:14px; }
.timeline-kpi-grid {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  align-items:stretch;
  margin:0 0 14px;
}
.timeline-stat-card {
  min-height:118px;
  height:100%;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}
.timeline-stat-card small,
.timeline-stat-card span { display:block; color:var(--muted); }
.timeline-stat-card strong { display:block; margin:5px 0; font-size:28px; line-height:1.1; color:var(--ink); overflow-wrap:anywhere; }
.timeline-workspace {
  display:grid;
  grid-template-columns:minmax(300px,.75fr) minmax(520px,1.25fr);
  gap:14px;
  align-items:start;
}
.timeline-filter-card,
.timeline-stream-card { min-width:0; }
.timeline-filter-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  align-items:end;
}
.timeline-filter-grid label {
  display:grid;
  gap:6px;
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}
.timeline-filter-grid input,
.timeline-filter-grid select { width:100%; min-height:40px; }
.timeline-filter-wide,
.timeline-filter-actions { grid-column:1 / -1; }
.timeline-filter-actions { display:flex; justify-content:flex-end; }
.timeline-day-list {
  display:grid;
  gap:10px;
}
.timeline-day {
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-alt);
  overflow:hidden;
}
.timeline-day > summary {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  cursor:pointer;
  color:var(--ink);
  font-weight:800;
}
.timeline-day > summary small {
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}
.timeline-row {
  display:grid;
  gap:8px;
  margin:0 10px 10px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface);
}
.timeline-row-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.timeline-detail {
  color:var(--muted);
  font-size:13px;
  white-space:pre-wrap;
}
.timeline-meta {
  color:var(--muted);
  font-size:12px;
}
.timeline-pill {
  display:inline-flex;
  align-items:center;
  padding:4px 9px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface-alt);
  color:var(--brand);
  font-size:12px;
  font-weight:800;
  text-transform:capitalize;
  white-space:nowrap;
}
.timeline-row-actions {
  display:flex;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.timeline-pager {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  margin-top:14px;
  padding-top:14px;
  border-top:1px solid var(--line);
}
.timeline-pager span {
  color:var(--muted);
  font-size:13px;
  font-weight:800;
}
.timeline-pager .btn.disabled {
  opacity:.45;
  pointer-events:none;
}
.timeline-modal-card { width:min(820px,100%); }
.timeline-modal-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  padding-bottom:12px;
  border-bottom:1px solid var(--line);
}
.timeline-modal-head h2 { margin:0; }
#timelineJourneyHead {
  margin-top:4px;
  color:var(--muted);
  font-size:13px;
}
.timeline-modal-close {
  width:38px;
  height:38px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface);
  color:var(--brand);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.timeline-modal-close:hover,
.timeline-modal-close:focus-visible {
  border-color:color-mix(in srgb, var(--brand), transparent 40%);
  color:#0f4f88;
  outline:none;
}
.timeline-journey-body {
  display:grid;
  gap:10px;
  margin-top:14px;
  max-height:60vh;
  overflow:auto;
}
.timeline-journey-row {
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface-alt);
  overflow:hidden;
}
.timeline-journey-row summary {
  padding:10px 12px;
  cursor:pointer;
}
.timeline-journey-detail {
  display:grid;
  gap:8px;
  padding:0 12px 12px;
  color:var(--muted);
  font-size:13px;
}
body.theme-dark .timeline-day,
body.theme-dark .timeline-row,
body.theme-dark .timeline-journey-row { background:var(--surface); border-color:var(--line); }
@media (max-width:1180px) {
  .timeline-kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .timeline-workspace { grid-template-columns:1fr; }
}
@media (max-width:760px) {
  .timeline-kpi-grid,
  .timeline-filter-grid { grid-template-columns:1fr; }
  .timeline-filter-wide,
  .timeline-filter-actions { grid-column:auto; }
  .timeline-row-head,
  .timeline-modal-head { display:grid; }
  .timeline-row-actions,
  .timeline-filter-actions,
  .timeline-pager { justify-content:flex-start; }
  .timeline-pager { flex-wrap:wrap; }
}

/* Activities workspace */
.activities-page-head { margin-bottom:14px; }
.activities-kpi-grid {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  align-items:stretch;
  margin:0 0 14px;
}
.activity-stat-card {
  min-height:118px;
  height:100%;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}
.activity-stat-card small,
.activity-stat-card span { display:block; color:var(--muted); }
.activity-stat-card strong { display:block; margin:5px 0; font-size:28px; line-height:1.1; color:var(--ink); }
.activities-workspace {
  display:grid;
  grid-template-columns:minmax(320px,.9fr) minmax(420px,1.1fr);
  gap:14px;
  align-items:stretch;
  margin-bottom:14px;
}
.activity-summary-card,
.activity-filter-card,
.activity-table-card { min-width:0; }
.activity-summary-card,
.activity-filter-card {
  height:100%;
}
.activity-filter-card {
  display:flex;
  flex-direction:column;
}
.activity-filter-card .activity-filter-grid {
  flex:1;
}
.activities-page-head .management-head-actions .btn {
  min-height:40px;
}
.activity-chart-grid {
  display:grid;
  grid-template-columns:repeat(7,minmax(54px,1fr));
  gap:10px;
  align-items:end;
  min-height:210px;
}
.activity-chart-day {
  display:grid;
  grid-template-rows:auto 130px auto;
  gap:8px;
  min-width:0;
}
.activity-chart-date,
.activity-chart-values { text-align:center; }
.activity-chart-date { color:var(--muted); font-size:12px; font-weight:700; }
.activity-chart-bars {
  display:flex;
  align-items:end;
  justify-content:center;
  gap:5px;
  min-height:130px;
  padding:8px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface-alt);
}
.activity-chart-bar {
  width:16px;
  height:4px;
  min-height:4px;
  border-radius:999px 999px 4px 4px;
}
.activity-chart-bar.count { background:var(--brand); }
.activity-chart-bar.duration { background:var(--accent); }
.activity-chart-bar.h-5 { height:5%; }
.activity-chart-bar.h-10 { height:10%; }
.activity-chart-bar.h-15 { height:15%; }
.activity-chart-bar.h-20 { height:20%; }
.activity-chart-bar.h-25 { height:25%; }
.activity-chart-bar.h-30 { height:30%; }
.activity-chart-bar.h-35 { height:35%; }
.activity-chart-bar.h-40 { height:40%; }
.activity-chart-bar.h-45 { height:45%; }
.activity-chart-bar.h-50 { height:50%; }
.activity-chart-bar.h-55 { height:55%; }
.activity-chart-bar.h-60 { height:60%; }
.activity-chart-bar.h-65 { height:65%; }
.activity-chart-bar.h-70 { height:70%; }
.activity-chart-bar.h-75 { height:75%; }
.activity-chart-bar.h-80 { height:80%; }
.activity-chart-bar.h-85 { height:85%; }
.activity-chart-bar.h-90 { height:90%; }
.activity-chart-bar.h-95 { height:95%; }
.activity-chart-bar.h-100 { height:100%; }
.activity-chart-values strong,
.activity-chart-values span { display:block; }
.activity-chart-values strong { font-size:13px; }
.activity-chart-values span { color:var(--muted); font-size:11px; }
.activity-filter-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  align-items:end;
}
.activity-filter-grid label {
  display:grid;
  gap:6px;
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}
.activity-filter-grid label small { font-weight:500; line-height:1.35; }
.activity-filter-grid input,
.activity-filter-grid select { width:100%; min-height:40px; }
.activity-filter-actions { display:flex; justify-content:flex-end; grid-column:1 / -1; }
.activity-table-card { margin-bottom:16px; overflow:visible; }
.activity-table-wrap table { min-width:0; }
.activity-table-wrap td { vertical-align:middle; }
.action-wrap { display:flex; align-items:center; justify-content:flex-end; gap:6px; flex-wrap:wrap; }
.activity-delete-form { margin:0; }
.activity-icon-btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:38px;
  height:38px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface);
  color:var(--brand);
  cursor:pointer;
  transition:border-color .2s ease, color .2s ease, background .2s ease, box-shadow .2s ease;
}
.activity-icon-btn:hover,
.activity-icon-btn:focus-visible {
  border-color:color-mix(in srgb, var(--brand), transparent 40%);
  background:var(--surface);
  color:#0f4f88;
  outline:none;
}
.activity-icon-btn.danger { color:var(--danger); }
.inline-edit { cursor:pointer; }
.inline-edit:hover { background:#eef8fb; color:var(--brand); }
.activity-day-group td {
  background:#eef5fb !important;
  color:var(--ink);
  font-weight:800;
  border-top:1px solid var(--line);
}
.activity-day-group span { margin-right:8px; }
.activity-day-group small { color:var(--muted); font-weight:700; }
.activity-target-highlight td { animation: activity-row-flash 1.4s ease-out 1; }
.is-hidden { display:none !important; }
.activity-chip-wrap {
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}
.activity-stacked-form {
  display:grid;
  gap:10px;
}
.activity-inline-actions,
.activity-modal-actions {
  display:flex;
  justify-content:flex-end;
  gap:8px;
  margin-top:12px;
}
.activity-action-modal-head {
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:flex-start;
  margin-bottom:12px;
}
.activity-action-modal-head h2,
.activity-modal-head h2 {
  margin:0;
}
.activity-entry-modal-card {
  width:min(980px, calc(100vw - 32px));
  max-height:calc(100vh - 48px);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.task-action-modal-card,
.task-entry-modal-card {
  width:min(980px, calc(100vw - 32px));
}
.task-action-modal-card {
  max-height:calc(100vh - 48px);
  overflow:hidden;
}
.activity-entry-modal-card .activity-modal-head {
  flex:0 0 auto;
  padding-bottom:14px;
  border-bottom:1px solid var(--line);
}
.activity-entry-modal-card form {
  min-height:0;
  overflow:auto;
  padding-right:4px;
}
.activity-form-sections {
  display:grid;
  gap:14px;
  padding:16px 2px 4px;
}
.activity-form-section {
  display:grid;
  gap:12px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-alt);
}
.activity-form-section-head {
  display:grid;
  align-items:start;
  gap:12px;
  padding-bottom:10px;
  border-bottom:1px solid var(--line);
}
.activity-form-section-head h3 {
  margin:0;
  color:var(--ink);
  font-size:15px;
}
.activity-form-section-head p {
  margin:2px 0 0;
  color:var(--muted);
  font-size:12px;
}
.activity-entry-modal-card .activity-form-grid,
.task-entry-modal-card .activity-form-grid,
.task-action-modal-card .activity-form-grid {
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
  padding:0;
}
.activity-entry-modal-card .activity-form-row,
.task-entry-modal-card .activity-form-row,
.task-action-modal-card .activity-form-row {
  grid-template-columns:1fr;
  gap:7px;
  min-height:0;
  overflow:visible;
  border:0;
  border-radius:0;
}
.activity-entry-modal-card .activity-form-row.wide,
.task-entry-modal-card .activity-form-row.wide,
.task-action-modal-card .activity-form-row.wide {
  grid-column:span 2;
}
.activity-entry-modal-card .activity-form-row > .label-cell,
.task-entry-modal-card .activity-form-row > .label-cell,
.task-action-modal-card .activity-form-row > .label-cell {
  display:block;
  padding:0;
  border:0;
  background:transparent;
  color:var(--ink);
  font-size:12px;
  font-weight:800;
}
.activity-entry-modal-card .activity-form-row > .input-cell,
.task-entry-modal-card .activity-form-row > .input-cell,
.task-action-modal-card .activity-form-row > .input-cell {
  padding:0;
  align-items:stretch;
}
.activity-entry-modal-card .activity-form-row input,
.activity-entry-modal-card .activity-form-row select,
.activity-entry-modal-card .activity-form-row textarea,
.task-entry-modal-card .activity-form-row input,
.task-entry-modal-card .activity-form-row select,
.task-entry-modal-card .activity-form-row textarea,
.task-action-modal-card .activity-form-row input,
.task-action-modal-card .activity-form-row select,
.task-action-modal-card .activity-form-row textarea {
  width:100%;
  min-height:42px;
  border-color:var(--line);
  border-radius:9px;
  background:var(--surface);
}
.activity-entry-modal-card .activity-form-row textarea,
.task-entry-modal-card .activity-form-row textarea,
.task-action-modal-card .activity-form-row textarea {
  min-height:112px;
}
.activity-entry-modal-card .input-with-actions,
.task-entry-modal-card .input-with-actions,
.task-action-modal-card .input-with-actions {
  grid-template-columns:minmax(0,1fr) auto auto;
  align-items:center;
  gap:8px;
}
.activity-entry-modal-card .suggest-inline,
.task-entry-modal-card .suggest-inline,
.task-action-modal-card .suggest-inline {
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:8px;
}
.activity-entry-modal-card .dragdrop-zone,
.task-entry-modal-card .dragdrop-zone,
.task-action-modal-card .dragdrop-zone {
  border:1px dashed #a9c8d6;
  border-radius:12px;
  padding:16px;
  background:var(--surface-alt);
}
.activity-entry-modal-card .attach-actions,
.task-entry-modal-card .attach-actions,
.task-action-modal-card .attach-actions {
  display:flex;
  justify-content:flex-start;
  gap:8px;
  margin-top:8px;
}
.activity-entry-modal-card .activity-modal-actions,
.task-entry-modal-card .activity-modal-actions,
.task-action-modal-card .activity-modal-actions {
  position:sticky;
  bottom:0;
  flex:0 0 auto;
  padding-top:14px;
  border-top:1px solid var(--line);
  background:var(--surface);
}
.task-action-modal-card > .task-tabs {
  flex:0 0 auto;
  padding:10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-alt);
  overflow-x:auto;
}
.task-action-modal-card > .task-panel {
  min-height:0;
  overflow:auto;
  padding:14px 4px 2px;
}
.task-action-modal-card > .task-panel.active {
  display:grid;
  gap:14px;
}
.task-action-modal-card > .task-panel > form,
.task-action-modal-card > .task-panel > .task-summary-card,
.task-action-modal-card > .task-panel > .activity-form-grid,
.task-action-modal-card > .task-panel > .activity-read-journey,
.task-action-modal-card #taskWatchersBox {
  padding:14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-alt);
  box-shadow:0 8px 24px rgba(17,44,72,.05);
}
.task-action-modal-card .task-summary-card {
  margin-bottom:0;
}
.task-action-modal-card .task-form-actions {
  padding-top:12px;
  margin-top:12px;
  border-top:1px solid var(--line);
}
.task-action-modal-card .field-hint,
.task-action-modal-card small {
  color:var(--muted);
}
.task-action-modal-card .alert {
  margin:0;
  border-radius:12px;
}
.activity-action-tabs {
  margin-bottom:10px;
}
.task-tab-btn {
  min-height:38px;
  padding:8px 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface);
  color:var(--brand);
  font:inherit;
  font-size:13px;
  font-weight:700;
  cursor:pointer;
}
.task-tab-btn:hover,
.task-tab-btn:focus-visible,
.task-tab-btn.active {
  border-color:color-mix(in srgb, var(--brand), transparent 40%);
  background:#eef9fb;
  color:#075b6b;
  outline:none;
}
.activity-modal-close {
  width:38px;
  height:38px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface);
  color:var(--brand);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.activity-modal-close:hover,
.activity-modal-close:focus-visible {
  border-color:color-mix(in srgb, var(--brand), transparent 40%);
  color:#0f4f88;
  outline:none;
}
.activity-modal-subhead {
  margin:0;
}
.activity-journey-head,
.activity-read-meta {
  margin-bottom:10px;
  color:var(--muted);
}
.activity-journey-body {
  display:grid;
  gap:8px;
  max-height:60vh;
  overflow:auto;
}
.activity-journey-detail {
  padding:0;
}
.activity-journey-summary {
  padding:10px 12px;
  cursor:pointer;
}
.activity-journey-detail-body {
  padding:0 12px 12px;
  color:var(--muted);
}
.activity-read-card {
  padding:12px;
}
.activity-read-message {
  white-space:pre-wrap;
  line-height:1.45;
}
.activity-read-title {
  margin:14px 0 8px;
}
.activity-read-journey {
  display:grid;
  gap:8px;
  max-height:45vh;
  overflow:auto;
}
.activity-ref-pill {
  display:inline-flex;
  gap:6px;
  align-items:center;
}
.activity-ref-remove-btn {
  padding:2px 6px;
  min-height:0;
}
.is-hidden {
  display:none !important;
}
.visually-hidden-file {
  position:absolute;
  width:1px;
  height:1px;
  opacity:0;
  pointer-events:none;
}
.tasks-kpi-grid {
  margin-bottom:14px;
}
.tasks-page-head,
.task-integration-card,
.task-tracking-card {
  min-width:0;
}
.task-integration-card,
.task-tracking-card {
  margin-bottom:16px;
}
.task-connection-grid {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}
.task-connection-card {
  min-height:148px;
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-content:start;
  gap:12px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface);
}
.task-connection-card h3 {
  margin:0 0 4px;
  font-size:15px;
}
.task-connection-card p {
  margin:0;
  color:var(--muted);
  line-height:1.45;
}
.task-connection-icon {
  width:40px;
  height:40px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid #cde4ee;
  border-radius:999px;
  color:var(--brand);
  background:#eef9fb;
}
.task-connection-actions {
  grid-column:1 / -1;
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  margin-top:auto;
}
.task-tracking-card {
  display:grid;
  gap:14px;
  overflow:visible;
}
.task-section-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
}
.task-section-head h2 {
  margin:0 0 4px;
}
.task-section-head p {
  margin:0;
  color:var(--muted);
}
.task-toolbar {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:12px;
  align-items:center;
  padding:10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-alt);
}
.task-tabs,
.task-toolbar-actions,
.task-view-switch {
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  min-width:0;
}
.task-toolbar-actions {
  justify-content:flex-end;
}
.task-switch {
  padding:0 2px;
  white-space:nowrap;
}
.task-panel,
.task-view {
  display:none;
  min-width:0;
}
.task-panel.active,
.task-view.active {
  display:block;
}
.task-panel > .task-view-list.active {
  display:block;
}
.task-panel .portal-datatable-toolbar {
  justify-content:flex-end;
}
.task-panel .portal-datatable-scroll {
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
}
.task-datatable {
  margin:0 !important;
}
.task-datatable th,
.task-datatable td {
  vertical-align:middle;
}
.task-panel .dataTables_wrapper {
  display:block !important;
  width:100% !important;
}
.task-panel .dataTables_wrapper .portal-datatable-scroll table,
.task-panel .dataTables_wrapper table.task-datatable,
.task-panel .dataTables_wrapper table.dataTable {
  width:100% !important;
  min-width:100%;
}
.task-panel .dataTables_wrapper table.task-datatable th,
.task-panel .dataTables_wrapper table.task-datatable td {
  max-width:none;
}
.task-panel .dataTables_wrapper table.task-datatable th:last-child,
.task-panel .dataTables_wrapper table.task-datatable td:last-child {
  width:132px;
}
.task-status-cell {
  font-weight:800;
  text-transform:capitalize;
}
.task-status-pill {
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:5px 10px;
  border:1px solid #cfe3ee;
  border-radius:999px;
  background:#f3f9fc;
  color:#0f5f74;
  font-size:12px;
  font-weight:900;
  white-space:nowrap;
}
.task-datatable .action-wrap {
  justify-content:flex-end;
}
.task-kanban-board {
  display:grid;
  grid-template-columns:repeat(5,minmax(220px,1fr));
  gap:12px;
  align-items:start;
  width:100%;
  overflow-x:auto;
  padding-bottom:4px;
}
.task-kanban-column {
  min-width:220px;
  display:flex;
  flex-direction:column;
  gap:10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-alt);
  padding:10px;
}
.task-kanban-column-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  min-height:34px;
  color:var(--ink);
  font-size:13px;
  font-weight:800;
}
.task-kanban-column-body {
  display:grid;
  gap:10px;
  min-height:190px;
  align-content:start;
  padding:2px;
  border-radius:10px;
}
.task-kanban-column-body.dragover {
  outline:2px dashed #72bfca;
  outline-offset:3px;
  background:#eef9fb;
}
.task-kanban-card {
  display:grid;
  gap:7px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface);
  box-shadow:0 8px 18px rgba(17,44,72,.06);
  cursor:grab;
}
.task-kanban-card:active {
  cursor:grabbing;
}
.task-kanban-title {
  color:var(--ink);
  font-size:14px;
  font-weight:800;
  line-height:1.35;
}
.task-kanban-meta {
  color:var(--muted);
  font-size:12px;
  line-height:1.35;
  overflow-wrap:anywhere;
}
.task-kanban-card .action-wrap {
  justify-content:flex-start;
  margin-top:4px;
}
.task-kanban-empty {
  margin:0;
}
.task-due-overdue {
  border-color:#f0a8b5 !important;
  background:#fff4f6 !important;
}
.task-due-soon {
  border-color:#f0d187 !important;
  background:#fff9e9 !important;
}
.task-chip-row {
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-top:8px;
}
.task-chip-row .pill,
.activity-entry-modal-card .pill {
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.field-hint {
  display:block;
  margin-top:6px;
  color:var(--muted);
}
.danger-hint {
  color:#8b1f35;
}
.task-summary-card,
.task-note-card {
  padding:10px;
  margin-bottom:10px;
}
.task-muted-block {
  margin-top:6px;
  color:var(--muted);
}
.task-description-block {
  margin-top:8px;
  color:var(--ink);
  white-space:pre-wrap;
}
.task-description-text,
.task-note-text,
.task-note-link {
  margin-top:6px;
}
.task-form-actions {
  display:flex;
  justify-content:flex-end;
  margin-top:10px;
}
.task-spaced-form {
  margin-top:10px;
}
.task-inline-actions {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}
.task-note-list {
  display:grid;
  gap:8px;
  margin-top:8px;
  color:var(--muted);
}
.task-note-head {
  display:flex;
  justify-content:space-between;
  gap:8px;
  flex-wrap:wrap;
}
.task-note-meta {
  font-size:12px;
  color:var(--muted);
}
.task-note-text {
  white-space:pre-wrap;
}

.lead-page-head {
  display:grid;
  gap:16px;
}
.lead-head-main,
.lead-workspace-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}
.lead-head-main h1 { margin:0 0 6px; }
.lead-head-main p:not(.eyebrow) {
  margin:0;
  color:var(--muted);
}
.lead-head-actions { align-items:center; }
.lead-section-gap { margin-top:2px; }
.lead-stats-strip {
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:12px;
  align-items:stretch;
}
.lead-stat-card,
.lead-chart-card {
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
  box-shadow:0 10px 28px rgba(17,44,72,.06);
}
.lead-stat-card {
  min-height:92px;
  display:grid;
  align-content:center;
  gap:7px;
  padding:16px;
}
.lead-stat-card span {
  color:var(--muted);
  font-size:13px;
  font-weight:800;
}
.lead-stat-card strong {
  color:var(--ink);
  font-size:28px;
  line-height:1;
}
.lead-stat-wide strong { color:var(--brand); }
.lead-insight-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}
.lead-chart-card {
  min-height:154px;
  display:grid;
  grid-template-rows:auto 1fr;
  gap:12px;
  padding:14px;
}
.lead-chart-head {
  display:flex;
  justify-content:space-between;
  gap:10px;
  color:var(--ink);
}
.lead-chart-head span {
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}
.lead-bar-chart {
  display:flex;
  align-items:end;
  gap:8px;
  min-height:82px;
}
.lead-bar-item {
  flex:1 1 0;
  min-width:28px;
  display:grid;
  justify-items:center;
  align-items:end;
  gap:5px;
}
.lead-bar {
  width:100%;
  max-width:34px;
  min-height:8px;
  border-radius:8px 8px 4px 4px;
  background:linear-gradient(180deg, #17a2ad, #125fa3);
}
.lead-bar-h1 { height:8px; }
.lead-bar-h2 { height:14px; }
.lead-bar-h3 { height:20px; }
.lead-bar-h4 { height:26px; }
.lead-bar-h5 { height:32px; }
.lead-bar-h6 { height:38px; }
.lead-bar-h7 { height:44px; }
.lead-bar-h8 { height:50px; }
.lead-bar-h9 { height:56px; }
.lead-bar-h10 { height:62px; }
.lead-bar-value,
.lead-bar-label,
.lead-chart-empty {
  color:var(--muted);
  font-size:11px;
  font-weight:800;
}
.leads-workspace-card {
  display:grid;
  gap:14px;
  overflow:visible;
}
.lead-workspace-head { margin-bottom:0; }

/* Opportunities */
.opportunity-page-head { margin-bottom:16px; }
.opportunity-overview-card { margin:0 0 16px; padding:20px; }
.opportunity-overview-card .opportunity-stats-strip { margin-top:0; }
.opportunity-overview-card .opportunity-insight-grid { margin-top:16px; }
.opportunity-table-head { padding:0 0 16px; margin-bottom:16px; border-bottom:1px solid var(--line); }
.opportunity-table-head h2 { margin:0; font-size:20px; }
.opportunity-table-head p { margin:4px 0 0; }
.opportunities-workspace-card { margin-top:0; padding:20px; }
.opportunity-toolbar { padding:12px; margin-bottom:16px; border:1px solid var(--line); border-radius:8px; background:var(--surface-alt); }
.opportunity-filter-shell { min-width:0; }
.opportunity-table-wrap { border:1px solid var(--line); border-radius:8px; overflow:auto; }
.opportunity-table-wrap table { margin:0; width:100%; }
.opportunity-table-wrap tbody tr { border-bottom:1px solid var(--line); }
.opportunity-table-wrap tbody tr:last-child { border-bottom:0; }
.opportunity-table-wrap tbody tr:nth-child(even) { background:#fbfdff; }
.opportunity-table-wrap tbody tr:hover { background:#f0f7fc; }
.opportunity-form-section { margin-top:14px; padding:16px; background:var(--surface-alt); border:1px solid var(--line); border-radius:8px; }
.opportunity-form-section-head { display:flex; align-items:flex-start; gap:10px; margin-bottom:14px; }
.opportunity-form-section-head > i { display:grid; place-items:center; width:36px; height:36px; flex:0 0 36px; border-radius:50%; color:var(--brand); background:#eaf6fa; }
.opportunity-form-section-head h3 { margin:0; font-size:16px; }
.opportunity-form-section-head p { margin:3px 0 0; color:var(--muted); font-size:13px; }
.opportunity-form-grid { gap:14px; }
.opportunity-form-grid .activity-form-row { grid-template-columns:1fr; align-content:start; overflow:visible; padding:12px; gap:7px; background:var(--surface); }
.opportunity-form-grid .activity-form-row > .label-cell { padding:0; border:0; background:transparent; font-weight:700; color:var(--ink); }
.opportunity-form-grid .activity-form-row > .input-cell { padding:0; }
.opportunity-form-grid .input-cell input,
.opportunity-form-grid .input-cell select,
.opportunity-form-grid .input-cell textarea { width:100%; min-height:42px; }
.lead-view-switch { justify-content:flex-end; }
.lead-toolbar {
  display:grid;
  grid-template-columns:minmax(260px,1fr) auto;
  gap:12px;
  align-items:center;
  padding:10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-alt);
}
.lead-toolbar-actions {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.lead-search-wrap {
  min-height:42px;
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:8px;
  padding:0 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface);
}
.lead-search-wrap i { color:var(--brand); }
.lead-search-wrap input {
  width:100%;
  min-width:0;
  border:0;
  background:transparent;
  outline:0;
}
.lead-hide-switch {
  min-height:40px;
  padding:0 4px;
  white-space:nowrap;
}
.lead-filter-menu { position:relative; }
.lead-filter-menu > summary {
  list-style:none;
  cursor:pointer;
}
.lead-filter-menu > summary::-webkit-details-marker { display:none; }
.lead-filter-grid {
  position:absolute;
  right:0;
  z-index:20;
  width:min(640px, calc(100vw - 72px));
  margin-top:8px;
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
  box-shadow:0 18px 38px rgba(17,44,72,.16);
}
.lead-filter-grid label {
  display:grid;
  gap:6px;
  color:var(--muted);
  font-size:12px;
  font-weight:800;
}
.lead-filter-grid select,
.lead-filter-grid input {
  width:100%;
  min-height:40px;
}
.lead-table-wrap table { min-width:1180px; }
.lead-inline-status {
  min-height:34px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  text-transform:capitalize;
}
.lead-modal-card {
  width:min(980px, calc(100vw - 32px));
  max-height:calc(100vh - 48px);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.lead-modal-card .contact-modal-head {
  flex:0 0 auto;
  padding-bottom:14px;
  border-bottom:1px solid var(--line);
}
.lead-modal-card form,
.lead-modal-card > .activity-form-grid,
.lead-modal-card > .mini-list {
  min-height:0;
  overflow:auto;
}
.lead-related-grid { grid-template-columns:minmax(140px,.45fr) minmax(0,1fr); }
.lead-related-list,
.lead-mini-list { margin-top:8px; }
.lead-context-section { margin-top:8px; }
.lead-context-section:first-child { margin-top:0; }
.lead-context-body,
.lead-detail-meta,
.lead-detail-actions { margin-top:8px; }
.lead-kanban-owner {
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}
.lead-kanban-actions {
  display:flex;
  align-items:center;
  gap:8px;
}
.lead-danger-action {
  color:var(--danger);
  border-color:#f0bdc6;
}
.lead-toast-stack {
  position:fixed;
  right:20px;
  bottom:20px;
  z-index:1200;
  display:grid;
  gap:8px;
  width:min(360px, calc(100vw - 40px));
}
.lead-toast {
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
  box-shadow:0 18px 42px rgba(17,44,72,.18);
  color:var(--ink);
  font-weight:800;
  transition:opacity .2s ease, transform .2s ease;
}
.lead-toast.ok i { color:var(--ok); }
.lead-toast.error i { color:var(--danger); }
.lead-toast.leaving {
  opacity:0;
  transform:translateY(8px);
}

.notes-hero,
.note-integration-card,
.notes-control-card,
.notes-sections {
  min-width:0;
}
.notes-hero,
.note-integration-card,
.notes-control-card {
  margin-bottom:18px;
}
.notes-hero {
  display:grid;
  gap:14px;
}
.notes-head-row {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}
.notes-kpi-strip {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  align-items:stretch;
}
.notes-kpi {
  min-height:86px;
  display:grid;
  align-content:center;
  gap:4px;
  padding:16px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
  box-shadow:var(--shadow-soft);
}
.notes-kpi span {
  color:var(--muted);
  font-weight:800;
}
.notes-kpi strong {
  color:var(--ink);
  font-size:30px;
  line-height:1;
}
.note-connection-grid {
  align-items:stretch;
}
.note-connection-card {
  min-height:152px;
}
.notes-control-card,
.notes-section-card {
  padding:16px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface);
  box-shadow:var(--shadow-soft);
}
.notes-control-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.notes-control-head strong,
.notes-section-head h2 {
  color:var(--ink);
}
.notes-control-head span,
.notes-section-head span {
  display:block;
  margin-top:3px;
  color:var(--muted);
  font-size:13px;
}
.notes-toolbar {
  display:grid;
  grid-template-columns:minmax(260px,1fr) auto auto auto;
  gap:12px;
  align-items:end;
}
.notes-search-wrap {
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:8px;
  min-height:42px;
  padding:0 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface-alt);
  color:var(--muted);
}
.notes-search-wrap input {
  min-height:40px;
  padding:0;
  border:0;
  background:transparent;
  box-shadow:none;
}
.notes-window-form label {
  display:grid;
  gap:5px;
  color:var(--muted);
  font-size:12px;
  font-weight:800;
}
.notes-window-form select {
  min-height:42px;
}
.notes-page-meta,
.notes-pager,
.notes-section-pager {
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.notes-page-meta span {
  min-height:34px;
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  color:var(--muted);
  background:var(--surface-alt);
  font-size:12px;
  font-weight:800;
}
.notes-sections {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px;
  align-items:start;
}
.notes-section-card {
  display:grid;
  gap:12px;
}
.notes-section-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding-bottom:12px;
  border-bottom:1px solid var(--line);
}
.notes-section-head h2 {
  margin:0;
  font-size:20px;
}
.notes-section-head strong {
  min-width:42px;
  min-height:34px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--line);
  border-radius:999px;
  color:var(--brand);
  background:#eef9fb;
}
.notes-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:12px;
  align-items:stretch;
}
.note-card {
  min-height:210px;
  display:grid;
  align-content:start;
  gap:10px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
  box-shadow:0 8px 24px rgba(17,44,72,.06);
}
.note-card-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.note-card-head h3 {
  margin:0 0 4px;
  color:var(--ink);
  font-size:16px;
}
.note-card-head span,
.note-card-meta {
  color:var(--muted);
  font-size:12px;
}
.note-card-meta {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.note-card-preview {
  margin:0;
  color:var(--ink);
  line-height:1.45;
}
.note-card-actions {
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:auto;
}
.notes-empty-state {
  min-height:180px;
  display:grid;
  place-items:center;
  align-content:center;
  gap:8px;
  padding:18px;
  border:1px dashed var(--line);
  border-radius:12px;
  color:var(--muted);
  background:var(--surface-alt);
  text-align:center;
}
.notes-empty-state i {
  color:var(--brand);
  font-size:24px;
}
.notes-section-pager {
  display:none;
  justify-content:center;
  padding-top:4px;
}
.notes-section-pager.active {
  display:flex;
}
.note-modal-card {
  width:min(1080px, calc(100vw - 32px));
}
.note-editor-tools {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px;
  padding:8px;
  border:1px solid var(--line);
  border-bottom:0;
  border-radius:12px 12px 0 0;
  background:#fbfdff;
}
.note-editor-tools .btn {
  min-height:34px;
  padding:7px 10px;
}
.note-editor {
  min-height:220px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:0 0 12px 12px;
  background:var(--surface);
  color:var(--ink);
  line-height:1.55;
  outline:none;
  overflow:auto;
}
.note-editor:focus {
  box-shadow:inset 0 0 0 3px rgba(19,138,155,.10);
}
.notes-inline-check {
  margin-top:10px;
}
.notes-relation-row,
.chip-wrap {
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.notes-relation-row select {
  flex:0 0 170px;
}
.notes-relation-row input {
  flex:1 1 260px;
}
.note-attachment-list {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:10px;
}

.note-tone-1 { border-top:3px solid #11808f; }
.note-tone-2 { border-top:3px solid #125fa3; }
.note-tone-3 { border-top:3px solid #1a8f5a; }
.note-tone-4 { border-top:3px solid #d68d26; }
.note-tone-5 { border-top:3px solid #0ea5a5; }
.note-tone-6 { border-top:3px solid #607d9b; }
.note-tone-7 { border-top:3px solid #8b6fc7; }
.note-tone-8 { border-top:3px solid #cb3d52; }

@media (max-width:1200px) {
  .notes-toolbar {
    grid-template-columns:1fr 220px;
  }
  .notes-page-meta,
  .notes-pager {
    grid-column:1 / -1;
  }
  .notes-sections {
    grid-template-columns:1fr;
  }
}
@media (max-width:760px) {
  .notes-head-row {
    display:grid;
  }
  .notes-kpi-strip,
  .notes-toolbar,
  .notes-relation-row {
    grid-template-columns:1fr;
  }
  .notes-relation-row {
    display:grid;
  }
  .notes-relation-row select,
  .notes-relation-row input {
    width:100%;
    flex:auto;
  }
}

.calendar-hero,
.calendar-integration-card,
.calendar-layout {
  min-width:0;
}
.calendar-hero,
.calendar-integration-card {
  margin-bottom:18px;
}
.calendar-hero {
  display:grid;
  gap:14px;
}
.calendar-head-row {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}
.calendar-kpi-strip {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  align-items:stretch;
}
.calendar-kpi {
  min-height:86px;
  display:grid;
  align-content:center;
  gap:4px;
  padding:16px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
  box-shadow:var(--shadow-soft);
}
.calendar-kpi span {
  color:var(--muted);
  font-weight:800;
}
.calendar-kpi strong {
  color:var(--ink);
  font-size:30px;
  line-height:1;
}
.calendar-connection-grid {
  align-items:stretch;
}
.calendar-connection-card {
  min-height:152px;
}
.calendar-layout {
  display:grid;
  grid-template-columns:minmax(0,1.55fr) minmax(320px,.75fr);
  gap:18px;
  align-items:start;
}
.calendar-main-card,
.calendar-detail-card {
  min-width:0;
  padding:16px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface);
  box-shadow:var(--shadow-soft);
}
.calendar-main-card {
  min-height:760px;
}
.calendar-side-stack {
  display:grid;
  gap:18px;
  min-width:0;
}
.calendar-card-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding-bottom:12px;
  margin-bottom:12px;
  border-bottom:1px solid var(--line);
}
.calendar-card-head h2 {
  margin:0;
  color:var(--ink);
  font-size:20px;
}
.calendar-card-head span {
  display:block;
  margin-top:3px;
  color:var(--muted);
  font-size:13px;
}
.calendar-source-legend {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.calendar-source-legend span {
  min-height:32px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:5px 9px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface-alt);
  color:var(--muted);
  font-weight:800;
}
.calendar-dot {
  width:9px;
  height:9px;
  display:inline-block;
  border-radius:999px;
}
.calendar-dot.m365 { background:#0b5cab; }
.calendar-dot.google { background:#1a8f5a; }
.calendar-dot.portal { background:#11999e; }
#calendar-app {
  min-height:660px;
}
#calendar-app .fc {
  color:var(--ink);
}
#calendar-app .fc-toolbar {
  gap:10px;
  flex-wrap:wrap;
}
#calendar-app .fc-button {
  min-height:34px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface);
  color:var(--brand);
  box-shadow:none;
  font-weight:800;
  text-transform:none;
}
#calendar-app .fc-button-primary:not(:disabled).fc-button-active,
#calendar-app .fc-button-primary:not(:disabled):active,
#calendar-app .fc-button:hover {
  border-color:#8bcbd5;
  background:#eef9fb;
  color:#075b6b;
}
#calendar-app .fc-daygrid-day,
#calendar-app .fc-timegrid-slot,
#calendar-app .fc-scrollgrid {
  border-color:var(--line);
}
#calendar-app .fc-col-header-cell {
  background:var(--surface-alt);
}
#calendar-app .fc-event {
  border-radius:8px;
  padding:2px 4px;
  font-weight:800;
}
.calendar-action-card {
  display:grid;
  gap:10px;
  margin-bottom:12px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-alt);
}
.calendar-action-card h3 {
  margin:0;
  color:var(--ink);
}
#event-detail {
  display:grid;
  gap:8px;
  color:var(--ink);
}
#event-detail p {
  margin:0;
  padding:9px 10px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface-alt);
  overflow-wrap:anywhere;
}
.cal-modal-overlay {
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:rgba(8,19,35,.56);
  z-index:1200;
}
.cal-modal-overlay.active {
  display:flex;
}
.cal-modal-card {
  width:min(1120px, calc(100vw - 32px));
  max-height:calc(100vh - 40px);
  overflow:auto;
  display:grid;
  gap:12px;
  padding:18px;
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--surface);
  box-shadow:0 26px 70px rgba(17,44,72,.26);
}
.cal-modal-card h2 {
  margin:0;
  color:var(--ink);
}
.cal-tabs {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  padding:8px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-alt);
}
.cal-tab-btn {
  min-height:38px;
  padding:8px 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface);
  color:var(--brand);
  font:inherit;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
}
.cal-tab-btn:hover,
.cal-tab-btn:focus-visible,
.cal-tab-btn.active {
  border-color:#8bcbd5;
  background:#eef9fb;
  color:#075b6b;
  outline:none;
}
.cal-tab-panel {
  display:none;
  padding:14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
}
.cal-tab-panel.active {
  display:block;
}
.calendar-sync-form {
  margin-top:8px;
}
.cal-modal-footer {
  display:flex;
  justify-content:flex-end;
  gap:8px;
  padding-top:8px;
  border-top:1px solid var(--line);
}

@media (max-width:1200px) {
  .calendar-layout {
    grid-template-columns:1fr;
  }
}
@media (max-width:760px) {
  .calendar-head-row,
  .calendar-card-head {
    display:grid;
  }
  .calendar-kpi-strip {
    grid-template-columns:1fr;
  }
  .cal-modal-overlay {
    align-items:flex-end;
    padding:8px;
  }
  .cal-modal-card {
    width:100%;
    max-height:calc(100dvh - 16px);
    border-radius:16px 16px 10px 10px;
  }
}

.posts-hero {
  display:grid;
  gap:14px;
  margin-bottom:18px;
}
.posts-head-row,
.post-mail-head,
.post-reader-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.posts-kpi-strip {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  align-items:stretch;
}
.posts-kpi {
  min-height:86px;
  display:grid;
  align-content:center;
  gap:4px;
  padding:16px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
  box-shadow:var(--shadow-soft);
}
.posts-kpi span {
  color:var(--muted);
  font-weight:800;
}
.posts-kpi strong {
  color:var(--ink);
  font-size:30px;
  line-height:1;
}
.posts-connection-card {
  margin-bottom:18px;
}
.post-connection-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  align-items:stretch;
}
.post-connection-option {
  min-height:146px;
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  gap:12px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface);
}
.post-connection-option > div {
  min-width:0;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
}
.post-connection-option h3 {
  margin:0 0 4px;
  font-size:15px;
}
.post-connection-option p {
  margin:0 0 12px;
  color:var(--muted);
}
.post-connection-icon {
  width:42px;
  height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid #cde4ee;
  border-radius:999px;
  color:var(--brand);
  background:#eef9fb;
}
.post-connection-actions {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  margin-top:auto;
}
.post-compose-modal-card {
  width:min(1080px, calc(100vw - 32px));
}
.post-composer-shell {
  display:grid;
  gap:12px;
  padding:4px 2px;
}
.post-composer-route {
  display:grid;
  grid-template-columns:minmax(180px,240px) minmax(220px,1fr);
  gap:10px;
  align-items:center;
}
.post-composer-route select,
.post-composer-subject {
  width:100%;
  min-height:42px;
  border-radius:10px;
}
.post-composer-recipients {
  display:grid;
  grid-template-columns:42px minmax(0,1fr);
  gap:10px;
  align-items:start;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-alt);
}
.post-composer-to-label {
  min-height:38px;
  display:flex;
  align-items:center;
  color:var(--muted);
  font-size:12px;
  font-weight:900;
  text-transform:uppercase;
}
.post-composer-to-body {
  display:grid;
  gap:7px;
  min-width:0;
}
.post-editor-card {
  display:grid;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface);
  overflow:visible;
}
.post-editor-toolbar {
  position:relative;
  display:flex;
  align-items:center;
  gap:6px;
  padding:8px;
  border-bottom:1px solid var(--line);
  background:#fbfdff;
}
.post-editor-toolbar .btn-icon {
  width:34px;
  height:34px;
  min-height:34px;
}
.post-editor-surface {
  min-height:230px;
  padding:16px;
  color:var(--ink);
  line-height:1.55;
  outline:none;
  overflow:auto;
}
.post-editor-surface:empty::before {
  content:attr(data-placeholder);
  color:#9aaabc;
}
.post-editor-surface:focus {
  box-shadow:inset 0 0 0 3px rgba(19,138,155,.10);
}
.post-editor-textarea {
  display:none;
}
.post-emoji-wrap {
  position:relative;
  margin-left:auto;
}
.post-emoji-panel {
  position:absolute;
  right:0;
  top:calc(100% + 8px);
  width:260px;
  display:none;
  grid-template-columns:repeat(5,1fr);
  gap:6px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
  box-shadow:0 18px 40px rgba(17,44,72,.18);
  z-index:20;
}
.post-emoji-panel.active {
  display:grid;
}
.post-emoji-panel button {
  min-height:38px;
  border:1px solid var(--line);
  border-radius:9px;
  background:var(--surface-alt);
  cursor:pointer;
  font-size:20px;
}
.post-emoji-panel button:hover,
.post-emoji-panel button:focus-visible {
  border-color:#8bcbd5;
  background:#eef9fb;
  outline:none;
}
.post-composer-extras {
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-alt);
  overflow:hidden;
}
.post-composer-extras summary {
  padding:12px 14px;
  cursor:pointer;
  color:var(--brand);
  font-weight:900;
}
.post-composer-extras-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  padding:0 12px 12px;
}
.post-reference-box {
  display:grid;
  gap:8px;
  min-width:0;
  padding:12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface);
}
.post-reference-box strong {
  color:var(--ink);
  font-size:13px;
}
.post-reference-box-wide {
  grid-column:1 / -1;
}
.post-chip-row {
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-top:7px;
}
.post-reference-stack {
  display:grid;
  gap:12px;
}
.post-mail-layout {
  display:grid;
  grid-template-columns:minmax(260px, .8fr) minmax(420px, 1.4fr) minmax(280px, .85fr);
  gap:18px;
  align-items:stretch;
  min-height:680px;
}
.post-mail-col {
  min-width:0;
  min-height:680px;
  display:flex;
  flex-direction:column;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface);
  box-shadow:var(--shadow-soft);
  overflow:hidden;
}
.post-mail-head {
  padding:14px;
  border-bottom:1px solid var(--line);
  background:#fbfdff;
}
.post-mailbox-head {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:start;
}
.post-mail-head strong {
  display:block;
  color:var(--ink);
  font-size:15px;
}
.post-mail-head span {
  color:var(--muted);
  font-size:12px;
}
.posts-segment-tight {
  margin:0;
}
.posts-segment {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
}
.post-mailbox-head .posts-segment {
  justify-content:flex-end;
}
.post-mail-tools {
  padding:10px 12px;
  border-bottom:1px solid var(--line);
}
.posts-search-wrap {
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:8px;
  min-height:40px;
  padding:0 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface-alt);
  color:var(--muted);
}
.posts-search-wrap input {
  min-height:38px;
  padding:0;
  border:0;
  background:transparent;
  box-shadow:none;
}
.post-mail-body,
.post-reader-right,
.post-mail-center {
  min-height:0;
  overflow:auto;
}
.post-mail-list {
  display:none;
  gap:8px;
  padding:12px;
  align-content:start;
}
.post-mail-list.active {
  display:grid;
}
.post-mail-item {
  display:grid;
  gap:8px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface);
  cursor:pointer;
}
.post-mail-item:hover,
.post-mail-item.active {
  border-color:#8bcbd5;
  background:#eef9fb;
}
.post-mail-item.unread {
  border-left:4px solid var(--brand-2);
}
.post-mail-line {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  min-width:0;
}
.post-mail-line span {
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.post-mail-line small {
  flex:0 0 auto;
  color:var(--muted);
  font-size:11px;
}
.post-mail-subject {
  color:var(--ink);
  font-weight:900;
}
.post-attach-icon {
  color:var(--brand-2);
}
.post-mail-pager {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:10px 12px;
  border-top:1px solid var(--line);
}
.post-reader-actions {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}
.post-mail-center {
  display:grid;
  align-content:start;
  gap:14px;
  padding:16px;
}
.post-reader-subject-wrap {
  display:grid;
  gap:8px;
}
.post-reader-subject-wrap strong {
  color:var(--ink);
  font-size:20px;
}
.post-message-card {
  min-height:220px;
  padding:16px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-alt);
  color:var(--ink);
  white-space:pre-wrap;
}
.post-reader-right {
  display:grid;
  align-content:start;
  gap:12px;
  padding:12px;
}
.post-reader-right .posts-segment {
  align-items:center;
}
.post-context-list {
  display:grid;
  gap:8px;
}
.post-context-scroll {
  max-height:55vh;
  overflow:auto;
}
.post-journey-card {
  padding:0;
}
.post-journey-card summary {
  padding:10px 12px;
  cursor:pointer;
}
.post-journey-detail {
  padding:0 12px 12px;
  color:var(--muted);
}
.post-attachment-row {
  padding:10px 12px;
  display:flex;
  justify-content:space-between;
  gap:8px;
  align-items:center;
}
@media (max-width:1200px) {
  .post-mail-layout { grid-template-columns:1fr; min-height:0; }
  .post-mail-col { min-height:420px; }
  .posts-kpi-strip { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:760px) {
  .posts-head-row,
  .post-mail-head,
  .post-reader-head,
  .post-mailbox-head { display:grid; grid-template-columns:1fr; }
  .posts-kpi-strip,
  .post-connection-grid { grid-template-columns:1fr; }
  .post-composer-route,
  .post-composer-recipients,
  .post-composer-extras-grid { grid-template-columns:1fr; }
  .post-composer-to-label { min-height:0; }
  .post-emoji-panel { right:auto; left:0; width:min(260px, calc(100vw - 64px)); }
}
@keyframes activity-row-flash {
  0% { background:#fff5d6; }
  100% { background:transparent; }
}
body.theme-dark .activity-chart-bars,
body.theme-dark .activity-day-group td { background:var(--surface-alt) !important; }
body.theme-dark .inline-edit:hover { background:var(--surface-alt); }
@media (max-width:1180px) {
  .activities-kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .lead-stats-strip { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .lead-insight-grid { grid-template-columns:1fr; }
  .lead-toolbar { grid-template-columns:1fr; }
  .lead-toolbar-actions { justify-content:flex-start; }
  .task-connection-grid { grid-template-columns:1fr; }
  .task-toolbar { grid-template-columns:1fr; }
  .task-toolbar-actions { justify-content:flex-start; }
  .task-kanban-board { grid-template-columns:repeat(5,minmax(220px,260px)); }
  .activities-workspace { grid-template-columns:1fr; }
  .activity-entry-modal-card .activity-form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .activity-entry-modal-card .activity-form-row.wide { grid-column:span 2; }
  .activity-entry-modal-card .input-with-actions { grid-template-columns:1fr; }
}
@media (max-width:760px) {
  .activities-kpi-grid,
  .activity-filter-grid,
  .lead-stats-strip,
  .lead-filter-grid { grid-template-columns:1fr; }
  .lead-head-main,
  .lead-workspace-head,
  .lead-chart-head { display:grid; }
  .lead-filter-grid {
    position:static;
    width:100%;
  }
  .lead-modal-card { width:calc(100vw - 20px); max-height:calc(100vh - 20px); }
  .activity-entry-modal-card { width:calc(100vw - 20px); max-height:calc(100vh - 20px); }
  .task-action-modal-card { width:calc(100vw - 20px); max-height:calc(100vh - 20px); }
  .activity-form-section { padding:12px; }
  .activity-form-section-head { display:grid; }
  .activity-entry-modal-card .activity-form-grid,
  .task-action-modal-card .activity-form-grid,
  .lead-modal-card .activity-form-grid,
  .lead-related-grid { grid-template-columns:1fr; }
  .activity-entry-modal-card .activity-form-row.wide,
  .task-action-modal-card .activity-form-row.wide,
  .lead-modal-card .activity-form-row.wide { grid-column:auto; }
  .activity-entry-modal-card .suggest-inline,
  .task-action-modal-card .suggest-inline { grid-template-columns:1fr; }
  .activity-filter-actions,
  .activity-inline-actions,
  .activity-modal-actions,
  .action-wrap { justify-content:flex-start; }
  .activity-action-modal-head { display:grid; }
  .activity-chart-grid { grid-template-columns:repeat(7,minmax(44px,1fr)); overflow:auto; }
  .portal-dt-toolbar,
  .portal-dt-footer {
    display:grid;
    grid-template-columns:1fr;
    align-items:stretch;
  }
  .dataTables_wrapper .dataTables_filter input {
    width:100%;
    max-width:100%;
    margin:0;
  }
  .dataTables_wrapper .dataTables_length label,
  .dataTables_wrapper .dataTables_filter label {
    width:100%;
    justify-content:space-between;
  }
  .dataTables_wrapper .dataTables_paginate {
    text-align:left;
  }
}
.admin-users-toolbar { display:grid; gap:10px; }
.admin-filter-bar { display:grid; grid-template-columns:minmax(220px,1.5fr) repeat(3,minmax(130px,.85fr)) auto; gap:10px; align-items:end; }
.admin-filter-actions { display:flex; align-items:center; gap:8px; }
.admin-filter-actions .btn, .admin-filter-actions .admin-filter-clear { min-height:40px; display:inline-flex; align-items:center; }
.admin-filter-clear { color:var(--muted); font-weight:700; white-space:nowrap; }
.admin-filter-summary { margin:10px 0 0; color:var(--muted); }
.admin-users-list { overflow:visible; }
.admin-users-list-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:10px; }
.admin-users-list-head h2 { margin:0 0 4px; }
.admin-users-list-head .meta { margin:0; }
.admin-list-table { min-width:1120px; }
.admin-list-table .table-actions-heading { text-align:right; }
.admin-list-table td { vertical-align:middle; }
.admin-user-name { display:grid; gap:3px; }
.admin-user-name strong { font-size:14px; }
.admin-user-name small, .admin-muted { color:var(--muted); }
.admin-status-pill { display:inline-flex; border-radius:999px; padding:4px 9px; font-size:12px; font-weight:700; background:#eaf8f1; color:var(--ok); }
.admin-status-pill.inactive { background:var(--surface-alt); color:var(--muted); }
.admin-workload { display:flex; gap:5px; flex-wrap:wrap; }
.admin-workload span { border-radius:999px; background:var(--surface-alt); color:var(--brand); padding:3px 7px; font-size:11px; white-space:nowrap; }
.admin-row-actions { display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.management-tenant-list { display:inline-block; max-width:220px; color:var(--muted); font-size:12px; line-height:1.4; }
body.theme-dark .admin-status-pill { background:#183d2e; color:#9de2bd; }
body.theme-dark .admin-status-pill.inactive { background:var(--surface-alt); color:var(--muted); }
@media (max-width:1180px) { .admin-filter-bar { grid-template-columns:1fr 1fr; } .admin-filter-actions { grid-column:1 / -1; justify-content:flex-end; } }
@media (max-width:760px) { .admin-filter-bar { grid-template-columns:1fr; } .admin-filter-actions { justify-content:flex-start; } .admin-row-actions { justify-content:flex-start; } .admin-users-list-head { display:grid; } }
/* Restore the focused left-side role navigator. */
.management-role-layout { display:grid; grid-template-columns:minmax(220px,280px) minmax(0,1fr); gap:16px; align-items:start; }
.management-role-list { margin-bottom:0; padding:16px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); box-shadow:var(--shadow-soft); }
.management-role-list .management-panel-heading { display:flex; }
.management-role-tabs { display:grid; gap:7px; margin-top:16px; padding:0; overflow:visible; border:0; background:transparent; }
.management-role-tab { width:100%; min-width:0; flex:initial; }
.management-role-panels { min-width:0; width:auto; }
.management-role-panel { border-radius:var(--radius); }
.management-permission-groups { grid-template-columns:repeat(2,minmax(0,1fr)); }
@media (max-width: 1000px) { .management-permission-groups { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width: 760px) {
  .management-role-layout { grid-template-columns:1fr; }
  .management-permission-groups { grid-template-columns:1fr; }
  .management-head-actions { justify-content:flex-start; }
}

/* Portal theme tokens. */
body.theme-dark {
  --bg: #0f1822;
  --surface: #172533;
  --surface-alt: #1d3040;
  --ink: #e7f0f5;
  --muted: #9db2c1;
  --line: #304757;
  --brand: #7bc6df;
  --brand-2: #55b5bf;
  background: var(--bg);
}

body.theme-dark .topbar,
body.theme-dark .topbar-sub,
body.theme-dark .card,
body.theme-dark .page-head,
body.theme-dark .template-surface,
body.theme-dark .sidebar-profile,
body.theme-dark .quick-link,
body.theme-dark .topnav > a,
body.theme-dark .nav-group-toggle,
body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

body.theme-dark .topbar-sub { box-shadow: 4px 0 18px rgba(0, 0, 0, .22); }
body.theme-dark .topnav > a.active,
body.theme-dark .nav-group.active > .nav-group-toggle,
body.theme-dark .nav-group-menu a.active,
body.theme-dark .nav-group-menu a:hover { background: var(--surface-alt); color: #a8deea; }
body.theme-dark .topbar { border-color: var(--line); }
body.theme-dark .sidebar-brand { color: #e7f0f5; }
body.theme-dark .sidebar-profile + .topnav { border-color: var(--line); }
body.theme-dark .sidebar-profile-meta small,
body.theme-dark .userbox-meta small { color: var(--muted); }
body.theme-dark .menu-toggle-btn { background: #203544; border-color: #3b596a; color: #b7dce8; }
body.theme-dark .theme-toggle { border-color: #3b596a; }
body.theme-dark .portal-sidebar-collapsed .nav-group.open .nav-group-menu { background: var(--surface); border-color: var(--line); border-left-color: #6fc9dc; }
body.theme-dark .dashboard-card-tools button { background: var(--surface); color: var(--ink); border-color: var(--line); }
.dashboard-head { display:grid; gap:12px; margin-bottom:18px; border-top:3px solid var(--brand-2); }
.dashboard-head-top { display:flex; justify-content:space-between; gap:10px; align-items:center; flex-wrap:wrap; }
.everything-search-wrap { position:relative; display:flex; justify-content:center; }
.everything-search { min-width:min(840px, 100%); width:min(100%, 840px); padding:12px 14px; font-size:15px; border-radius:12px; border:1px solid #cad9ec; }
.quick-plus-btn { width:42px; height:42px; border-radius:10px; border:0; cursor:pointer; font-size:26px; line-height:1; color:#fff; background:linear-gradient(90deg, var(--brand), var(--brand-2)); }
.search-panel { position:absolute; top:calc(100% + 8px); left:50%; transform:translateX(-50%); width:min(100%, 980px); background:#fff; border:1px solid #d8e2f1; border-radius:12px; box-shadow:var(--shadow); padding:10px; z-index:40; max-height:70vh; overflow:auto; display:none; }
.search-panel.active { display:block; }
.search-category { margin-bottom:10px; }
.search-category h4 { margin:4px 0 8px; font-size:13px; color:#496079; text-transform:uppercase; letter-spacing:.03em; }
.search-item { display:block; border:1px solid #e2ebf8; border-radius:10px; padding:8px 10px; margin-bottom:6px; color:#12243d; background:#fbfdff; }
.search-item:hover { border-color:#a8c0e8; background:#f1f7ff; }
.search-item small { display:block; color:#607086; margin-top:2px; }

.dashboard-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.dashboard-reset-btn[hidden] { display:none; }
.dashboard-grid {
  display:grid;
  grid-template-columns:repeat(12,minmax(0,1fr));
  gap:14px;
  align-items:start;
}
.dashboard-col { display:contents; }
.dashboard-card { position:relative; grid-column:span 4; min-width:0; transition:box-shadow .18s ease, opacity .18s ease, transform .18s ease; }
.dashboard-card[data-card-span="8"] { grid-column:span 8; }
.dashboard-card[data-card-span="12"] { grid-column:1 / -1; }
.dashboard-card.is-dragging { opacity:.52; transform:scale(.99); }
.dashboard-card.is-drop-target { outline:2px dashed #6bb8ca; outline-offset:4px; }
.dashboard-card-tools { display:none; align-items:center; gap:4px; margin-left:auto; }
.dashboard-editing .dashboard-card-tools { display:inline-flex; }
.dashboard-card-head { display:flex; align-items:center; gap:8px; min-width:0; }
.dashboard-card-head h2 { min-width:0; flex:1; }
.dashboard-card-title { min-width:0; flex:1; font-size:20px; font-weight:700; color:var(--ink); }
.dashboard-card-original-title { display:none; }
.dashboard-drag-handle { cursor:grab; color:#6f8798; padding:4px 5px; border-radius:6px; }
.dashboard-drag-handle:active { cursor:grabbing; }
.dashboard-card-tools button { width:27px; height:27px; padding:0; border:1px solid #d3e1e9; border-radius:7px; background:#fff; color:#31566e; cursor:pointer; }
.dashboard-card-tools button:hover { background:#eef7fa; border-color:#8fc6d3; }
.dashboard-card-tools .dashboard-card-hide { color:#a13e4a; }
.dashboard-card.is-hidden-by-user { display:none; }
.dashboard-editing .dashboard-card { cursor:default; }
.dashboard-editing .dashboard-card > *:not(.dashboard-card-head) { pointer-events:auto; }
.dashboard-card-manager { margin-top:12px; padding:14px; border:1px solid var(--line); border-radius:14px; background:var(--surface-alt); box-shadow:0 8px 22px rgba(26,55,80,.06); }
.dashboard-card-manager[hidden] { display:none; }
.dashboard-card-manager-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; margin-bottom:12px; color:var(--ink); }
.dashboard-card-manager-head strong { display:block; font-size:14px; }
.dashboard-card-manager-head small { display:block; margin-top:3px; color:var(--muted); font-size:12px; }
.dashboard-manager-close { width:30px; height:30px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--muted); cursor:pointer; }
.dashboard-manager-close:hover { color:var(--brand); border-color:var(--brand); }
.dashboard-card-manager-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:8px; }
.dashboard-card-manager-item { display:flex; align-items:center; justify-content:space-between; gap:12px; min-width:0; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:var(--surface); }
.dashboard-card-manager-item.is-hidden { opacity:.72; }
.dashboard-card-manager-copy { min-width:0; }
.dashboard-card-manager-copy strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--ink); font-size:13px; }
.dashboard-card-manager-copy small { display:block; margin-top:3px; color:var(--muted); font-size:11px; }
.dashboard-card-manager-item .btn { flex:0 0 auto; min-height:30px; padding:5px 9px; font-size:12px; }
.dashboard-card > .dashboard-card-head { margin-bottom:12px; padding-bottom:10px; border-bottom:1px solid var(--line); }
.dashboard-card-head h2, .dashboard-card-head .dashboard-card-title { margin:0; line-height:1.25; }
.dashboard-card-intro { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; flex-wrap:wrap; }
.dashboard-card-intro h2 { margin:0; }
.dashboard-card-intro .meta { margin:4px 0 0; }
.dashboard-inline-action { margin-left:8px; }
.dashboard-alert-actions { display:flex; align-items:center; gap:10px; }
.dashboard-summary-meta { margin-top:10px; color:#546a84; font-size:13px; }
.dashboard-tight-meta { margin-top:-2px; }
.dashboard-spaced-chart { margin-top:12px; }
.dashboard-log-label { margin-top:8px; }
.dashboard-log-list { max-height:460px; }
.dashboard-item-description { margin-top:6px; white-space:pre-wrap; color:#455f7f; }
.text-danger { color:#a32840; }
.metric-bar-fill { display:block; height:100%; width:0; background:#168ea2; border-radius:999px; min-width:2px; }
.dashboard-card input, .dashboard-card select, .dashboard-card textarea { border-color:var(--line); background:var(--surface); color:var(--ink); border-radius:9px; }
.dashboard-card input:focus, .dashboard-card select:focus, .dashboard-card textarea:focus { border-color:var(--brand); box-shadow:0 0 0 3px rgba(15,139,158,.12); outline:0; }
.world-clock-item, .kpi-item, .daily-intel-item, .panel-item, .timeline-feed .item { background:var(--surface-alt); }
.metric-bar > span { background:#168ea2; }
.kpi-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.kpi-item { border:1px solid #d9e4f3; border-radius:12px; padding:10px; background:#fff; }
.kpi-item .k-label { color:#5c7089; font-size:12px; }
.kpi-item .k-value { font-size:24px; font-weight:700; color:#0f2c4c; }

.metric-chart { display:grid; gap:8px; margin-top:8px; }
.metric-row { display:grid; grid-template-columns: 170px 1fr 92px; gap:8px; align-items:center; }
.metric-row label { color:#5a6f87; font-size:12px; font-weight:600; }
.metric-bar { height:9px; border-radius:999px; background:#e7effb; overflow:hidden; }
.metric-bar > span { display:block; height:100%; background:linear-gradient(90deg, #1a78d1, #17a99a); border-radius:999px; min-width:2px; }
.metric-val { text-align:right; font-size:12px; color:#2b4360; }
.daily-intel-grid { display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:10px; }
.daily-intel-item { border:1px solid #d8e4f3; border-radius:10px; padding:10px; background:#fff; }
.daily-intel-item .k { color:#5c7089; font-size:12px; }
.daily-intel-item .v { color:#0f2c4c; font-size:20px; font-weight:700; margin-top:3px; }
.timesheet-alert { margin-bottom:14px; border:1px solid #f2d391; background:linear-gradient(180deg,#fff7dd,#fffaf0); box-shadow:0 10px 24px rgba(174,124,25,.10); }
.timesheet-alert-inner { display:flex; justify-content:space-between; gap:14px; align-items:center; flex-wrap:wrap; }
.timesheet-alert-copy { display:flex; gap:12px; align-items:flex-start; color:#5d4108; }
.timesheet-alert-icon { width:38px; height:38px; border-radius:12px; display:inline-flex; align-items:center; justify-content:center; background:#ffe9aa; color:#94630a; flex:0 0 auto; }
.timesheet-alert-copy h2 { margin:0; color:#744b04; }
.timesheet-alert-copy p { margin:4px 0 0; color:#735b27; }
.timesheet-missing-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; margin-top:12px; }
.timesheet-missing-card { border:1px solid #f0d7a2; border-radius:10px; padding:10px; background:#fffdf7; color:#5d4108; display:grid; gap:8px; }
.timesheet-missing-card strong { color:#744b04; }
.timesheet-missing-card .meta { color:#806936; }
.timesheet-missing-tag { display:inline-flex; width:max-content; border-radius:999px; padding:3px 8px; font-size:12px; font-weight:700; background:#fff0c7; color:#8a5d06; border:1px solid #f2d391; }
.world-clock-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.world-clock-item { border:1px solid #d8e4f3; border-radius:12px; padding:12px; background:linear-gradient(180deg, #f7fbff, #eef5ff); }
.world-clock-item .city { color:#4f6784; font-size:12px; text-transform:uppercase; letter-spacing:.06em; }
.world-clock-item .time { color:#0f2c4c; font-size:28px; font-weight:700; margin-top:4px; }
.world-clock-item .zone { color:#5f7590; font-size:12px; margin-top:3px; }

.panel-list { display:grid; gap:8px; max-height:320px; overflow:auto; padding-right:3px; }
.panel-item { border:1px solid #dce6f5; border-radius:10px; padding:9px; background:#fff; }
.panel-item.post-unread-item { background:#edf5ff; border-color:#9cc0ea; }
.panel-item .title { font-weight:600; color:#102a48; }
.panel-item .meta { color:#637894; font-size:12px; margin-top:3px; }
.open-case-alert { border-color:#ffd4de; background:linear-gradient(180deg,#fff7f9,#fff); }
.open-case-alert-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap; }
.open-case-alert-head h2 { margin:0; color:#8e1f36; }
.open-case-count { display:inline-flex; align-items:center; justify-content:center; min-width:34px; height:34px; border-radius:999px; background:#cf304a; color:#fff; font-weight:800; }
.open-case-list { display:grid; gap:8px; margin-top:12px; }
.open-case-row { display:grid; grid-template-columns:minmax(0,1.4fr) 130px 160px auto; gap:10px; align-items:center; border:1px solid #f0c7d0; border-radius:10px; padding:10px; background:#fff; color:#13233a; }
.open-case-row strong, .open-case-row span { overflow-wrap:anywhere; }
.open-case-row small { display:block; color:#637894; margin-top:2px; }
.open-case-priority { display:inline-flex; justify-content:center; border-radius:999px; padding:4px 9px; font-size:12px; font-weight:800; background:#fff0f3; color:#a32840; border:1px solid #ffd4de; }

.timeline-feed { display:grid; gap:8px; max-height:900px; overflow:auto; padding-right:3px; }
.timeline-feed .item { border:1px solid #dce6f5; border-radius:10px; padding:9px; background:#fff; }
.timeline-feed .top { display:flex; justify-content:space-between; gap:8px; align-items:center; }
.timeline-feed .mod { display:inline-block; font-size:12px; color:#49617f; border:1px solid #d0def1; background:#f2f7ff; border-radius:999px; padding:2px 8px; }
.timeline-feed .desc { color:#3f5875; font-size:13px; margin-top:6px; white-space:pre-wrap; }

.quick-note-modal { position:fixed; inset:0; background:rgba(8,19,35,.56); display:none; align-items:center; justify-content:center; z-index:1200; }
.quick-note-modal.active { display:flex; }
.quick-note-card { width:min(760px,95vw); max-height:90vh; overflow:auto; background:#fff; border:1px solid #d8e2f1; border-radius:12px; padding:14px; }

@media (max-width: 1300px) {
    .dashboard-grid { grid-template-columns: repeat(6,minmax(0,1fr)); }
    .dashboard-card { grid-column: span 3; }
    .dashboard-card[data-card-span="8"] { grid-column: span 6; }
    .dashboard-card[data-card-span="12"] { grid-column: 1 / -1; }
    .kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .daily-intel-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .timesheet-missing-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .world-clock-grid { grid-template-columns:1fr; }
    .everything-search { min-width:100%; }
    .open-case-row { grid-template-columns:1fr; }
}

@media (max-width: 760px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-card,
    .dashboard-card[data-card-span="8"],
    .dashboard-card[data-card-span="12"] { grid-column: 1 / -1; }
    .dashboard-actions { width:100%; }
}

/* Dashboard surfaces follow the global theme instead of hard-coded light colors. */
body.theme-dark .dashboard-head,
body.theme-dark .search-panel,
body.theme-dark .quick-note-card,
body.theme-dark .kpi-item,
body.theme-dark .daily-intel-item,
body.theme-dark .panel-item,
body.theme-dark .timeline-feed .item,
body.theme-dark .open-case-row {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
body.theme-dark .search-item { background: var(--surface-alt); color: var(--ink); border-color: var(--line); }
body.theme-dark .search-category h4,
body.theme-dark .kpi-item .k-label,
body.theme-dark .daily-intel-item .k,
body.theme-dark .panel-item .meta,
body.theme-dark .timeline-feed .desc,
body.theme-dark .timeline-feed .mod { color: var(--muted); }
body.theme-dark .kpi-item .k-value,
body.theme-dark .daily-intel-item .v,
body.theme-dark .panel-item .title,
body.theme-dark .world-clock-item .time { color: var(--ink); }
body.theme-dark .dashboard-summary-meta,
body.theme-dark .dashboard-item-description { color: var(--muted); }
body.theme-dark .world-clock-item { background: var(--surface-alt); border-color: var(--line); }
body.theme-dark .world-clock-item .city,
body.theme-dark .world-clock-item .zone,
body.theme-dark .metric-val { color: var(--muted); }
body.theme-dark .metric-bar { background: #2a4050; }
body.theme-dark .metric-bar > span { background: #65c3cf; }
body.theme-dark .timesheet-alert { background: #3a301c; border-color: #806b37; }
body.theme-dark .timesheet-alert-copy,
body.theme-dark .timesheet-alert-copy h2,
body.theme-dark .timesheet-alert-copy p,
body.theme-dark .timesheet-missing-card,
body.theme-dark .timesheet-missing-card strong,
body.theme-dark .timesheet-missing-card .meta { color: #f3dfaa; }
body.theme-dark .timesheet-missing-card { background: #2e281b; border-color: #806b37; }
body.theme-dark .open-case-alert { background: #351f27; border-color: #843c4d; }
body.theme-dark .open-case-alert-head h2 { color: #ffb9c6; }
body.theme-dark .open-case-priority { background: #4b2731; color: #ffc5cf; border-color: #843c4d; }

/* Central dashboard card system: shared sizing, hierarchy and responsive behavior. */
.dashboard-grid {
  --dashboard-gap: 16px;
  --dashboard-radius: 16px;
  gap: var(--dashboard-gap);
  grid-auto-flow: dense;
  grid-auto-rows: 8px;
}
.dashboard-card {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--dashboard-radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(22, 52, 76, .06);
  overflow: visible;
  grid-row-end: span 1;
}
.dashboard-card > h2,
.dashboard-card .dashboard-card-intro h2,
.dashboard-card .open-case-alert-head h2,
.dashboard-card .timesheet-alert-copy h2 { font-size: clamp(17px, 1.3vw, 21px); line-height: 1.3; letter-spacing: -.01em; }
.dashboard-card p,
.dashboard-card .meta,
.dashboard-card .desc { font-size: 13px; line-height: 1.55; }
.dashboard-card .dashboard-card-intro,
.dashboard-card .open-case-alert-head { margin-bottom: 12px; }
.dashboard-card .dashboard-card-intro > div:first-child,
.dashboard-card .open-case-alert-head > div:first-child { min-width: 0; }
.dashboard-card .dashboard-card-intro .meta,
.dashboard-card .open-case-alert-head .meta { color: var(--muted); }
.dashboard-card .kpi-grid,
.dashboard-card .daily-intel-grid,
.dashboard-card .world-clock-grid { margin-top: 0; }
.kpi-item,
.daily-intel-item,
.world-clock-item,
.panel-item,
.timeline-feed .item,
.open-case-row,
.timesheet-missing-card {
  border-color: var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
  color: var(--ink);
  box-shadow: none;
}
.kpi-item { padding: 12px; }
.kpi-item .k-label,
.daily-intel-item .k { font-size: 11px; line-height: 1.35; color: var(--muted); }
.kpi-item .k-value,
.daily-intel-item .v { font-size: clamp(20px, 2vw, 26px); line-height: 1.15; color: var(--ink); }
.world-clock-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.world-clock-item { padding: 14px; }
.world-clock-item .time { font-size: clamp(23px, 2.2vw, 30px); line-height: 1.1; color: var(--ink); }
.world-clock-item { display:grid; gap:7px; }
.world-clock-item .city { margin:0; }
.world-clock-settings { flex:0 0 auto; width:34px; height:34px; padding:0; }
.world-clock-settings.is-active { background:var(--brand); color:#fff; border-color:var(--brand); }
.world-clock-config-actions { display:flex; align-items:center; gap:8px; margin:-2px 0 12px; padding:8px 10px; border:1px solid var(--line); border-radius:10px; background:var(--surface-alt); color:var(--muted); font-size:12px; }
.world-clock-config-actions[hidden] { display:none; }
.world-clock-config-actions strong { min-width:18px; text-align:center; color:var(--ink); font-size:14px; }
.world-clock-config-actions small { margin-left:auto; color:var(--muted); }
.world-clock-config-actions .icon-btn { width:28px; height:28px; padding:0; }
.world-clock-config-actions .icon-btn:disabled { opacity:.4; cursor:not-allowed; }
.world-clock-item[hidden], .world-clock-item.is-hidden-by-count { display:none !important; }
.world-clock-select { display:none; width:100%; min-height:34px; margin-top:4px; padding:6px 9px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--ink); font:inherit; font-size:12px; }
.world-clocks-configuring .world-clock-select { display:block; }
.world-clock-select:focus { outline:0; border-color:var(--brand); box-shadow:0 0 0 3px rgba(15,139,158,.12); }
.panel-item { padding: 11px 12px; }
.panel-item .title { color: var(--ink); font-size: 13px; line-height: 1.4; }
.panel-item .meta,
.open-case-row small,
.timeline-feed .desc { color: var(--muted); }
.metric-bar { background: color-mix(in srgb, var(--line) 65%, transparent); }
.timesheet-alert,
.open-case-alert { box-shadow: none; }
.timesheet-alert { background: var(--surface-alt); border-color: #e6c778; }
.timesheet-alert-copy,
.timesheet-alert-copy h2,
.timesheet-alert-copy p { color: #6e510f; }
.timesheet-missing-card { padding: 12px; }
.open-case-alert { background: var(--surface-alt); border-color: #e5a9b7; }
.open-case-row { padding: 11px 12px; }
.timeline-feed { max-height: 560px; }

body.theme-dark .dashboard-card,
body.theme-dark .kpi-item,
body.theme-dark .daily-intel-item,
body.theme-dark .world-clock-item,
body.theme-dark .panel-item,
body.theme-dark .timeline-feed .item,
body.theme-dark .open-case-row,
body.theme-dark .timesheet-missing-card { background: var(--surface); border-color: var(--line); color: var(--ink); }
body.theme-dark .timesheet-alert { background: #30291b; border-color: #756234; }
body.theme-dark .timesheet-alert-copy,
body.theme-dark .timesheet-alert-copy h2,
body.theme-dark .timesheet-alert-copy p,
body.theme-dark .timesheet-missing-card,
body.theme-dark .timesheet-missing-card strong,
body.theme-dark .timesheet-missing-card .meta { color: #f0d994; }
body.theme-dark .open-case-alert { background: #321f27; border-color: #783d4d; }
body.theme-dark .quick-link-search { background: #173f49; border-color: #3b7f8b; color: #bcecf2; }

@media (max-width: 1100px) {
  .dashboard-card { padding: 15px; }
  .dashboard-card[data-card-span="8"] { grid-column: 1 / -1; }
  .metric-row { grid-template-columns: minmax(110px, 170px) minmax(0, 1fr) 78px; }
}
@media (max-width: 760px) {
  .dashboard-grid { gap: 12px; }
  .dashboard-card { padding: 14px; border-radius: 13px; }
  .dashboard-card > .dashboard-card-head { margin-bottom: 10px; padding-bottom: 8px; }
  .dashboard-card-intro, .open-case-alert-head, .timesheet-alert-inner { align-items: stretch; }
  .dashboard-card-intro > div, .open-case-alert-head > div { width: 100%; }
  .dashboard-card .kpi-grid,
  .dashboard-card .daily-intel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .timesheet-missing-grid { grid-template-columns: 1fr; }
  .metric-row { grid-template-columns: 1fr; gap: 4px; }
  .metric-val { text-align: left; }
  .dashboard-alert-actions { width: 100%; justify-content: space-between; }
  .dashboard-inline-action { margin-left: 0; }
  .world-clock-config-actions { flex-wrap:wrap; }
  .world-clock-config-actions small { width:100%; margin-left:0; }
  .world-clock-grid { grid-template-columns: 1fr; }
}

/* Shared modal foundation. Page-specific modal classes inherit this layer. */
.modal-overlay,
.employee-modal,
.admin-user-modal,
.top-modal,
.od-modal-overlay,
.mail365-modal-overlay,
.quick-note-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 32px);
  background: rgba(8, 24, 42, .62);
  backdrop-filter: blur(5px);
}
.modal-overlay.active,
.employee-modal.active,
.admin-user-modal.active,
.top-modal.active,
.od-modal-overlay.active,
.mail365-modal-overlay.active,
.quick-note-modal.active { display: flex; }
.modal-overlay.active > *,
.employee-modal.active > *,
.admin-user-modal.active > *,
.top-modal.active > *,
.od-modal-overlay.active > *,
.quick-note-modal.active > * { animation: modal-enter .18s ease-out both; }
@keyframes modal-enter { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-card,
.employee-modal-card,
.admin-user-modal-card,
.activity-modal-card,
.case-delete-modal,
.top-modal-card,
.od-modal-card,
.quick-note-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  max-height: min(900px, calc(100dvh - 32px));
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(4, 18, 33, .25);
  padding: clamp(16px, 2.5vw, 26px);
}
.modal-card.modal-wide,
.employee-modal-card.modal-wide,
.activity-modal-card.activity-followup-queue-card,
.top-modal-card.modal-wide { width: min(1080px, 100%); }
.modal-card h2, .modal-card h3,
.employee-modal-card h2, .admin-user-modal-card h2,
.activity-modal-card h2, .top-modal-card h2, .od-modal-card h2 { color: var(--ink); }
.modal-head,
.employee-modal-head,
.admin-user-modal-head,
.activity-modal-head,
.activity-followup-modal-head,
.top-modal-head,
.od-modal-head,
.mail365-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2, .modal-head h3,
.employee-modal-head h2, .admin-user-modal-head h2,
.activity-modal-head h2, .activity-followup-modal-head h2,
.top-modal-head h2, .od-modal-head h2, .mail365-modal-head h3 { margin: 0; line-height: 1.25; }
.modal-close,
.modal-card .activity-modal-close,
.employee-modal-card .icon-btn,
.admin-user-modal-card .icon-btn { flex: 0 0 auto; }
.modal-actions,
.employee-modal-actions,
.admin-user-modal-actions,
.activity-modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
body.modal-open { overflow: hidden; }
body.theme-dark .modal-overlay,
body.theme-dark .employee-modal,
body.theme-dark .admin-user-modal,
body.theme-dark .top-modal,
body.theme-dark .od-modal-overlay,
body.theme-dark .mail365-modal-overlay,
body.theme-dark .quick-note-modal { background: rgba(1, 8, 15, .76); }
body.theme-dark .modal-card,
body.theme-dark .employee-modal-card,
body.theme-dark .admin-user-modal-card,
body.theme-dark .activity-modal-card,
body.theme-dark .case-delete-modal,
body.theme-dark .top-modal-card,
body.theme-dark .od-modal-card,
body.theme-dark .quick-note-card { background: var(--surface); color: var(--ink); border-color: var(--line); }
@media (max-width: 640px) {
  .modal-overlay, .employee-modal, .admin-user-modal, .top-modal, .od-modal-overlay, .mail365-modal-overlay, .quick-note-modal { align-items: flex-end; padding: 8px; }
  .modal-card, .employee-modal-card, .admin-user-modal-card, .activity-modal-card, .case-delete-modal, .top-modal-card, .od-modal-card, .quick-note-card { width: 100%; max-height: calc(100dvh - 16px); border-radius: 16px 16px 10px 10px; padding: 16px; }
  .modal-actions, .employee-modal-actions, .admin-user-modal-actions, .activity-modal-actions { justify-content: stretch; }
  .modal-actions > .btn, .employee-modal-actions > .btn, .admin-user-modal-actions > .btn, .activity-modal-actions > .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-overlay.active > *, .employee-modal.active > *, .admin-user-modal.active > *, .top-modal.active > *, .od-modal-overlay.active > *, .quick-note-modal.active > * { animation: none; }
}

/* Top-bar Teams quick message panel. It is a floating workspace panel, not a page-level modal. */
.teams-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1580;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--brand-2);
  color: #fff;
  box-shadow: 0 12px 28px rgba(7, 62, 84, .24);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}
.teams-fab:hover { background: var(--brand); transform: translateY(-1px); }
.teams-fab-badge { min-width: 20px; height: 20px; align-items: center; justify-content: center; padding: 0 5px; border-radius: 999px; background: #e84c67; color: #fff; font-size: 11px; }
.teams-widget {
  position: fixed;
  right: 22px;
  bottom: 78px;
  z-index: 1590;
  display: none;
  width: min(760px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 120px));
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 26px 70px rgba(4, 18, 33, .28);
}
.teams-widget.open { display: flex; animation: modal-enter .18s ease-out both; }
.teams-widget-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 16px; border-bottom:1px solid var(--line); background:var(--surface); }
.teams-widget-head strong { font-size:15px; }
.teams-widget-head-actions { display:flex; align-items:center; gap:5px; }
.teams-widget-head-actions .btn { min-width:30px; padding:5px 8px; }
.teams-widget-body { display:grid; grid-template-columns:250px minmax(0,1fr); min-height:0; flex:1; }
.teams-widget-chats { min-width:0; padding:12px; border-right:1px solid var(--line); background:var(--surface-alt); overflow:auto; }
.teams-widget-search-wrap input, .teams-widget-newchat input, .teams-send-form textarea { width:100%; }
.teams-widget-newchat { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:7px; margin-top:8px; }
.teams-widget-newchat input { grid-column:1 / -1; }
.teams-chat-list { display:grid; gap:6px; margin-top:12px; }
.teams-chat-list > * { border:1px solid var(--line); border-radius:10px; background:var(--surface); }
.teams-widget-messages { display:flex; flex-direction:column; min-width:0; min-height:0; background:var(--surface); }
.teams-widget-chat-head { padding:12px 14px; border-bottom:1px solid var(--line); font-weight:700; }
.teams-message-list { display:grid; align-content:start; gap:8px; min-height:0; flex:1; padding:14px; overflow:auto; }
.teams-send-form { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; padding:10px 14px; border-top:1px solid var(--line); }
.teams-send-form textarea { min-height:42px; resize:vertical; }
body.theme-dark .teams-widget { background:var(--surface); border-color:var(--line); }
body.theme-dark .teams-widget-chats { background:var(--surface-alt); border-color:var(--line); }
@media (max-width: 700px) {
  .teams-fab { right:12px; bottom:12px; }
  .teams-widget { right:8px; bottom:66px; width:calc(100vw - 16px); height:calc(100dvh - 82px); border-radius:16px; }
  .teams-widget-body { grid-template-columns:1fr; }
  .teams-widget-chats { display:block; border-right:0; }
  .teams-widget.mobile-chat-open .teams-widget-chats { display:none; }
  .teams-widget-messages { display:none; }
  .teams-widget.mobile-chat-open .teams-widget-messages { display:flex; }
  .teams-mobile-back-btn { display:inline-flex; }
}
@media (min-width: 701px) { .teams-mobile-back-btn { display:none; } }

/* Management workflow */
.workflow-page-head { align-items: center; }
.workflow-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.workflow-kpi-card {
  min-height: 92px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.workflow-kpi-card span { display:block; color:var(--muted); font-weight:700; font-size:13px; }
.workflow-kpi-card strong { display:block; margin-top:8px; color:var(--ink); font-size:32px; line-height:1; }
.workflow-shell {
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(360px, 1.1fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}
.workflow-tree-card,
.workflow-detail-card,
.workflow-people-card,
.workflow-delegation-card { padding: clamp(16px, 2vw, 22px); }
.workflow-card-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}
.workflow-card-head h2 { margin:3px 0 0; }
.workflow-hint {
  display:inline-flex;
  align-items:center;
  gap:7px;
  min-height:34px;
  padding:7px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  color:var(--brand);
  background:var(--surface-alt);
  font-weight:800;
  font-size:12px;
}
.workflow-root-drop {
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  margin-bottom:12px;
  border:1px dashed var(--line-strong, var(--line));
  border-radius:12px;
  background:var(--surface-alt);
  color:var(--muted);
  font-weight:800;
}
.workflow-root-drop.is-drop-target,
.workflow-unit-node.is-drop-target {
  border-color:var(--brand-2);
  background:rgba(7, 132, 151, .1);
}
.workflow-tree-wrap { display:grid; gap:8px; }
.workflow-tree-list {
  list-style:none;
  display:grid;
  gap:8px;
  margin:0;
  padding:0;
}
.workflow-tree-list .workflow-tree-list {
  margin:8px 0 0 22px;
  padding-left:14px;
  border-left:1px solid var(--line);
}
.workflow-unit-node {
  width:100%;
  display:grid;
  grid-template-columns:38px minmax(0, 1fr) auto;
  align-items:center;
  gap:10px;
  min-height:58px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface);
  color:var(--ink);
  text-align:left;
  cursor:grab;
  font:inherit;
  box-shadow:0 8px 20px rgba(12, 31, 52, .04);
}
.workflow-unit-node:active { cursor:grabbing; }
.workflow-unit-node:hover,
.workflow-unit-node.is-selected {
  border-color:rgba(7, 132, 151, .45);
  box-shadow:0 12px 28px rgba(7, 62, 84, .12);
}
.workflow-unit-icon,
.workflow-avatar {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:38px;
  height:38px;
  border-radius:999px;
  background:var(--surface-alt);
  color:var(--brand);
  border:1px solid var(--line);
  font-weight:900;
}
.workflow-unit-copy { min-width:0; display:grid; gap:2px; }
.workflow-unit-copy strong,
.workflow-person-main strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.workflow-unit-copy small,
.workflow-person-main small,
.workflow-delegation-row small { color:var(--muted); }
.workflow-unit-count {
  min-width:28px;
  height:28px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  background:rgba(7, 132, 151, .1);
  color:var(--brand);
  font-size:12px;
  font-weight:900;
}
.workflow-form-card {
  display:grid;
  gap:12px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface-alt);
}
.workflow-panel-form .activity-form-row,
.workflow-modal-card .activity-form-row {
  display:grid;
  grid-template-columns:130px minmax(0, 1fr);
  align-items:center;
  gap:12px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
}
.workflow-panel-form .label-cell,
.workflow-modal-card .label-cell { color:var(--ink); font-weight:800; }
.workflow-panel-form input,
.workflow-panel-form select,
.workflow-modal-card input,
.workflow-modal-card select,
.workflow-delegation-form input,
.workflow-delegation-form select,
.workflow-people-list select {
  width:100%;
  min-height:42px;
}
.workflow-search {
  display:flex;
  align-items:center;
  gap:8px;
  min-width:min(320px, 100%);
  padding:0 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface);
  color:var(--muted);
}
.workflow-search input {
  width:100%;
  min-height:42px;
  border:0;
  background:transparent;
  outline:0;
}
.workflow-people-list { display:grid; gap:8px; }
.workflow-person-row {
  display:grid;
  grid-template-columns:minmax(220px, 1.3fr) minmax(180px, 1fr) minmax(180px, 1fr) auto;
  align-items:end;
  gap:10px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface);
}
.workflow-person-main {
  display:grid;
  grid-template-columns:42px minmax(0, 1fr);
  align-items:center;
  gap:10px;
  min-width:0;
}
.workflow-person-row label,
.workflow-delegation-grid label {
  display:grid;
  gap:6px;
  color:var(--muted);
  font-weight:800;
  font-size:12px;
}
.workflow-delegation-grid {
  grid-template-columns:repeat(4, minmax(0, 1fr));
  align-items:end;
}
.workflow-delegation-grid .workflow-wide { grid-column:span 3; }
.workflow-switch-inline { align-self:end; min-height:42px; }
.workflow-delegation-list { display:grid; gap:8px; margin-top:14px; }
.workflow-delegation-row {
  display:grid;
  grid-template-columns:minmax(220px, 1fr) minmax(180px, .8fr) auto auto;
  align-items:center;
  gap:12px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface);
}
.workflow-delegation-row > div { display:grid; gap:3px; }
.workflow-empty {
  padding:18px;
  border:1px dashed var(--line);
  border-radius:14px;
  background:var(--surface-alt);
  color:var(--muted);
  text-align:center;
  font-weight:700;
}
.mini-list-spaced { margin-top:8px; }
.context-block-sm { margin-top:6px; }
.context-block { margin-top:10px; }
body.theme-dark .workflow-kpi-card,
body.theme-dark .workflow-unit-node,
body.theme-dark .workflow-person-row,
body.theme-dark .workflow-delegation-row,
body.theme-dark .workflow-panel-form .activity-form-row,
body.theme-dark .workflow-modal-card .activity-form-row { background:var(--surface); border-color:var(--line); }
body.theme-dark .workflow-root-drop,
body.theme-dark .workflow-form-card,
body.theme-dark .workflow-empty { background:var(--surface-alt); border-color:var(--line); }
@media (max-width: 1180px) {
  .workflow-kpi-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .workflow-shell { grid-template-columns:1fr; }
  .workflow-person-row { grid-template-columns:1fr 1fr; }
  .workflow-person-main { grid-column:1 / -1; }
  .workflow-delegation-grid,
  .workflow-delegation-row { grid-template-columns:1fr 1fr; }
  .workflow-delegation-grid .workflow-wide { grid-column:1 / -1; }
}
@media (max-width: 700px) {
  .workflow-kpi-grid,
  .workflow-person-row,
  .workflow-delegation-grid,
  .workflow-delegation-row,
  .workflow-panel-form .activity-form-row,
  .workflow-modal-card .activity-form-row { grid-template-columns:1fr; }
  .workflow-card-head { display:grid; }
  .workflow-search { min-width:0; }
  .workflow-tree-list .workflow-tree-list { margin-left:10px; padding-left:10px; }
}

/* Sales pipeline management */
.pipeline-overview-grid {
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:14px;
}
.pipeline-card { padding:clamp(16px, 2vw, 22px); min-height:230px; }
.pipeline-card-head {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:16px;
}
.pipeline-title-line {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
}
.pipeline-title-line h2 { margin:0; }
.pipeline-card-head p { margin:6px 0 0; color:var(--muted); }
.pipeline-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.pipeline-stage-strip {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(110px, 1fr));
  gap:8px;
  margin:14px 0;
}
.pipeline-stage-chip {
  display:grid;
  gap:3px;
  min-height:64px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-alt);
}
.pipeline-stage-chip strong { color:var(--ink); font-size:13px; }
.pipeline-stage-chip small { color:var(--brand); font-weight:900; }
.pipeline-stage-chip.is-closed { background:rgba(26, 47, 71, .05); }
.pipeline-card-meta {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  color:var(--muted);
  font-weight:800;
  font-size:13px;
}
.pipeline-card-meta span {
  display:inline-flex;
  align-items:center;
  gap:6px;
  min-height:32px;
  padding:6px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--surface);
}
.pipeline-form-grid {
  grid-template-columns:repeat(2, minmax(0, 1fr));
  margin-bottom:14px;
}
.pipeline-form-grid .activity-form-row {
  display:grid;
  grid-template-columns:120px minmax(0, 1fr);
  align-items:center;
  gap:12px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
}
.pipeline-form-grid .activity-form-row.wide { grid-column:1 / -1; }
.pipeline-form-grid .label-cell { font-weight:800; color:var(--ink); }
.pipeline-editor-grid {
  display:grid;
  grid-template-columns:minmax(0, 1.2fr) minmax(320px, .8fr);
  gap:14px;
}
.pipeline-editor-card {
  display:grid;
  gap:10px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface-alt);
}
.pipeline-editor-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.pipeline-editor-head h3 { margin:0; }
.pipeline-stage-editor,
.pipeline-access-editor { display:grid; gap:8px; }
.pipeline-edit-row {
  display:grid;
  grid-template-columns:minmax(90px, .8fr) minmax(130px, 1.2fr) 76px auto auto 34px;
  align-items:center;
  gap:8px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
}
.pipeline-access-row { grid-template-columns:minmax(180px, 1fr) 120px 34px; }
.pipeline-edit-row input,
.pipeline-edit-row select,
.pipeline-form-grid input {
  width:100%;
  min-height:40px;
}
body.theme-dark .pipeline-card,
body.theme-dark .pipeline-stage-chip,
body.theme-dark .pipeline-card-meta span,
body.theme-dark .pipeline-form-grid .activity-form-row,
body.theme-dark .pipeline-edit-row { background:var(--surface); border-color:var(--line); }
body.theme-dark .pipeline-editor-card { background:var(--surface-alt); border-color:var(--line); }
@media (max-width: 1100px) {
  .pipeline-overview-grid,
  .pipeline-editor-grid,
  .pipeline-form-grid { grid-template-columns:1fr; }
  .pipeline-form-grid .activity-form-row.wide { grid-column:auto; }
}
@media (max-width: 760px) {
  .pipeline-card-head,
  .pipeline-editor-head { display:grid; }
  .pipeline-edit-row,
  .pipeline-access-row,
  .pipeline-form-grid .activity-form-row { grid-template-columns:1fr; }
}
