/* CIPM workspace design system: emerald actions, slate text, neutral surfaces. */
:root {
  --primary: #087f68;
  --primary2: #12a184;
  --accent: #a66313;
  --bg: #f5f7f9;
  --surface: #fff;
  --surface2: #f0f4f6;
  --text: #182b35;
  --muted: #60717b;
  --border: #e2e8ec;
  --success: #087f68;
  --danger: #b42335;
  --warning: #975e12;
  --shadow: 0 2px 5px rgba(24, 43, 53, 0.025);
  --r: 12px;
}
body {
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
.app-shell {
  grid-template-columns: 252px minmax(0, 1fr);
}
.sidebar {
  width: 252px;
  background: #fff;
  color: var(--text);
  border-right: 1px solid var(--border);
  padding: 24px 16px 16px;
}
.sidebar .brand {
  color: #183b35;
  gap: 11px;
  padding: 0 10px 28px;
  font-size: 17px;
  letter-spacing: -0.6px;
}
.sidebar .brand-mark {
  background: #087f68;
  border-radius: 11px;
  box-shadow: none;
  width: 36px;
  height: 36px;
  font-size: 14px;
}
.sidebar > .nav {
  scrollbar-color: #d3dfe2 transparent;
  gap: 12px;
}
.nav-group {
  border-top: 0;
  padding: 0;
}
.nav-group > summary {
  color: #677b83;
  font-size: 10px;
  letter-spacing: 0.1em;
  min-height: 37px;
  padding: 0 11px;
}
.nav-group > summary:hover {
  background: #f5f8f9;
  color: #233c45;
}
.nav-chevron {
  color: #8b9ca3;
  font-size: 17px;
}
.nav-group-items {
  gap: 4px;
}
.nav-group-items button {
  color: #4e636d;
  font-size: 12px;
  font-weight: 600;
  min-height: 42px;
  padding: 10px 12px;
  gap: 11px;
  border-radius: 8px;
}
.nav button:hover {
  color: #076b59;
  background: #f0f7f5;
}
.nav button.active {
  color: #056b57;
  background: #e6f4ef;
  font-weight: 700;
}
.nav button.active:before {
  display: none;
}
.nav button.active .icon {
  color: #087f68;
}
.sidebar-user {
  border-top: 1px solid var(--border);
  padding: 18px 10px 0;
}
.sidebar-user strong {
  color: #243f47;
  font-size: 12px;
}
.sidebar-user small {
  color: var(--muted);
  font-size: 11px;
}
.sidebar-user .btn {
  background: #f8fafb;
  border-color: var(--border);
  color: #4e636d;
}
.topbar {
  background: rgba(255, 255, 255, 0.96);
  height: 78px;
  padding: 0 36px;
  backdrop-filter: blur(12px);
}
.topbar h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.workspace-context {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.workspace-context > small {
  font-size: 10px;
  color: #6d818a;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.topbar .queue-shortcut {
  background: #fff;
  color: #34555b;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.content {
  padding: 32px 36px 48px;
  max-width: 1600px;
  width: 100%;
}
h1,
h2,
h3 {
  color: #19343e;
}
.content > h2,
.page-head h2 {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.8px;
  line-height: 1.3;
  margin: 0 0 8px;
}
.content > p,
.page-head p {
  color: var(--muted);
  line-height: 1.7;
}
.page-head {
  align-items: center;
  margin-bottom: 26px;
}
.page-eyebrow {
  color: #087f68;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 9px;
}
.overview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.btn {
  background: var(--primary);
  font-size: 12px;
  font-weight: 650;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(24, 43, 53, 0.05);
  transition:
    background 0.15s,
    border-color 0.15s;
}
.btn:hover {
  background: #066b58;
  transform: none;
}
.btn.secondary {
  border-color: #dbe4e7;
  color: #3e5761;
  box-shadow: 0 1px 2px rgba(24, 43, 53, 0.025);
}
.btn.secondary:hover {
  background: #f0f6f4;
  border-color: #b5d3c9;
}
.btn.danger {
  background: var(--danger);
}
.btn.danger:hover {
  background: #941b2a;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.card {
  border-color: var(--border);
  box-shadow: var(--shadow);
  border-radius: 12px;
}
.panel {
  padding: 24px;
}
.panel-head {
  margin-bottom: 20px;
  gap: 12px;
}
.panel h3,
.panel-head h3 {
  font-size: 14px;
  letter-spacing: -0.2px;
  font-weight: 700;
}
.panel-head a {
  font-size: 12px;
  font-weight: 650;
}
.kpis {
  gap: 16px;
  margin-bottom: 26px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.kpi {
  padding: 22px 20px;
  position: relative;
  overflow: hidden;
}
.kpi small {
  color: #60747d;
  font-size: 11px;
  font-weight: 600;
}
.kpi strong {
  font-size: 31px;
  font-weight: 700;
  margin: 12px 0 8px;
  line-height: 1.1;
  color: #1f3e46;
}
.kpi .trend {
  color: #71838a;
  font-size: 10px;
}
.kpi:first-child {
  border-color: #c4e4d8;
  background: #f1faf6;
}
.kpi:first-child strong {
  color: #087f68;
}
.dashboard-grid {
  gap: 24px;
  grid-template-columns: minmax(0, 1.65fr) minmax(270px, 1fr);
  align-items: start;
}
.dashboard-grid > * {
  min-width: 0;
}
.dashboard-grid .table-wrap table {
  min-width: 560px;
}
.dashboard-grid > .panel + .panel {
  margin-top: 0;
}
.bar {
  height: 7px;
  background: #eef3f3;
}
.bar span {
  background: #14a385;
}
.bar-row {
  font-size: 11px;
  font-weight: 600;
  color: #546a73;
}
.activity-item {
  border-color: #edf1f3;
  padding: 14px 0;
}
.activity-item strong {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
}
.activity-item small {
  font-size: 10px;
  margin-top: 3px;
}
.table-wrap,
.crm-table-wrap {
  border: 1px solid #e5ebee;
  border-radius: 10px;
  background: #fff;
  overflow-x: auto;
}
.table-wrap table,
.crm-table {
  font-size: 12px;
}
thead th,
.crm-table th {
  background: #f7f9fa;
  color: #6b7f87;
  font-size: 10px;
  letter-spacing: 0.065em;
  font-weight: 700;
  padding: 13px 16px;
  border-bottom: 1px solid #e5ebee;
}
tbody td,
.crm-table td {
  padding: 16px;
  border-bottom: 1px solid #edf1f3;
  color: #455e68;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: #f8fbfa;
}
td strong,
td a {
  color: #234d49;
  font-weight: 650;
}
td small {
  font-size: 10px;
  color: #7c8d95;
  margin-top: 4px;
}
.badge {
  font-size: 10px;
  font-weight: 650;
  padding: 4px 9px;
  border-radius: 6px;
}
.badge.new {
  background: #edf3ff;
  color: #3e61a4;
}
.badge.open {
  background: #edf4ff;
  color: #3c63a8;
}
.badge.resolved {
  background: #e7f6ee;
  color: #20764f;
}
.badge.pending {
  background: #fff4de;
  color: #91621d;
}
.badge.closed {
  background: #edf1f3;
  color: #596f79;
}
.badge.urgent,
.badge.high {
  background: #fdecef;
  color: #a43850;
}
.toolbar {
  gap: 12px;
}
.page-head > .toolbar {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
}
.field {
  gap: 6px;
}
.field label,
label {
  font-size: 12px;
  font-weight: 600;
  color: #435e68;
}
.field label {
  margin-bottom: 0;
}
.field input,
.field select,
.field textarea,
.toolbar input,
.toolbar select {
  border-color: #dbe4e8;
  background: #fff;
  border-radius: 8px;
  font-size: 12px;
  padding: 11px 12px;
}
input::placeholder,
textarea::placeholder {
  color: #8b9ba3;
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--primary);
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.toolbar input:focus,
.toolbar select:focus {
  border-color: #239e84;
  box-shadow: 0 0 0 3px #e5f4ee;
}
.rm-form input:focus,
.rm-form select:focus,
.rm-form textarea:focus {
  outline: 2px solid #51b69d;
  outline-offset: 2px;
}
:where(button, a, summary):focus-visible {
  outline: 2px solid #087f68;
  outline-offset: 3px;
}
.nav-group summary:focus-visible,
.nav-group button:focus-visible {
  outline-color: #087f68;
}
.helper {
  color: #667b84;
  font-size: 11px;
  line-height: 1.7;
}
.crm-tabs {
  gap: 5px;
  padding: 5px;
  background: #ebf0f2;
  border: 0;
  border-radius: 10px;
  width: fit-content;
  max-width: 100%;
}
.crm-tabs a {
  font-size: 12px;
  color: #5c727b;
  padding: 9px 13px;
  border-radius: 7px;
}
.crm-tabs a[aria-current="page"] {
  background: #fff;
  color: #087f68;
  box-shadow: 0 1px 4px #182b3510;
}
.crm-tabs a:hover {
  color: #087f68;
  background: #f8fbfa;
}
.crm-stats {
  gap: 16px;
}
.crm-stats h2 {
  font-size: 30px;
  color: #214b44;
  letter-spacing: -1px;
}
.crm-stats small {
  color: #677e87;
  font-size: 11px;
}
.rm-checklist {
  gap: 12px;
  margin-top: 24px;
}
.rm-checklist .panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  margin: 0;
}
.rm-checklist strong {
  font-size: 12px;
  font-weight: 600;
}
.rm-checklist a {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 650;
}
.modal {
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 80px #183b3533;
}
.modal-backdrop {
  background: rgba(20, 37, 43, 0.42);
  backdrop-filter: blur(3px);
}
@media (min-width: 821px) and (max-width: 1180px) {
  .content {
    padding: 28px 24px;
  }
  .topbar {
    padding: 0 24px;
  }
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    width: min(86vw, 280px);
    box-shadow: 14px 0 45px #183b351f;
  }
  .topbar {
    height: 68px;
    padding: 0 16px;
    gap: 10px;
  }
  .topbar h1 {
    font-size: 14px;
  }
  .workspace-context > small {
    font-size: 9px;
  }
  .content {
    padding: 24px 16px 36px;
  }
  .content > h2,
  .page-head h2 {
    font-size: 22px;
  }
  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }
  .dashboard-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }
  .kpis,
  .crm-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .kpi {
    padding: 18px 16px;
  }
  .kpi strong {
    font-size: 28px;
  }
  .panel {
    padding: 18px;
  }
  .rm-checklist .panel {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
  }
  .crm-tabs {
    width: 100%;
  }
  .btn {
    min-height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
/* The overview shows essentials; the full queue retains every column. */
.dashboard-recent .table-wrap table {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}
.dashboard-recent :is(th, td):nth-child(4),
.dashboard-recent :is(th, td):nth-child(5) {
  display: none;
}
.dashboard-recent :is(th, td):first-child {
  width: 34%;
}
.dashboard-recent :is(th, td) {
  padding: 14px 12px;
  overflow-wrap: anywhere;
}
.dashboard-recent :is(th, td):nth-child(3) {
  width: 18%;
}
.content h2[tabindex="-1"]:focus {
  outline: none;
}
#queue-filters {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 16px;
}
#queue-filters .field {
  margin: 0;
}
#queue-filters label {
  margin-bottom: 6px;
}
#queue-filters .btn {
  min-height: 44px;
}
.density-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #5b727c;
  font-size: 11px;
  border-radius: 8px;
}
.density-toggle:hover,
.density-toggle[aria-pressed="true"] {
  color: #087f68;
  background: #eef7f3;
  border-color: #cce5dc;
}
.density-toggle .icon {
  width: 16px;
  height: 16px;
}
html[data-density="compact"] .content {
  padding-top: 22px;
}
html[data-density="compact"] .panel {
  padding: 16px;
}
html[data-density="compact"] .kpi {
  padding: 16px;
}
html[data-density="compact"] :is(td, .crm-table td) {
  padding-top: 9px;
  padding-bottom: 9px;
}
html[data-density="compact"] .field {
  margin-bottom: 10px;
}
html[data-density="compact"] #queue-filters {
  padding: 14px;
  gap: 10px;
}
html[data-density="compact"] .nav-group-items button {
  min-height: 36px;
  padding-top: 7px;
  padding-bottom: 7px;
}
/* Motion gives feedback without delaying navigation or input. */
@media (prefers-reduced-motion: no-preference) {
  .content {
    animation: workspace-enter 0.22s ease-out both;
  }
  .kpi {
    animation: metric-enter 0.32s ease-out both;
    transition:
      box-shadow 0.18s,
      border-color 0.18s,
      translate 0.18s;
  }
  .kpi:nth-child(2) {
    animation-delay: 0.035s;
  }
  .kpi:nth-child(3) {
    animation-delay: 0.07s;
  }
  .kpi:nth-child(4) {
    animation-delay: 0.105s;
  }
  .kpi:nth-child(5) {
    animation-delay: 0.14s;
  }
  .bar span {
    transform-origin: left;
    animation: chart-enter 0.65s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  .nav-group-items button,
  .crm-tabs a,
  .density-toggle {
    transition:
      background 0.16s,
      color 0.16s,
      box-shadow 0.16s;
  }
  .nav-chevron {
    transition: transform 0.18s;
  }
  .btn:active {
    transform: scale(0.98);
  }
  .modal {
    animation: workspace-enter 0.18s ease-out;
  }
}
@media (hover: hover) {
  .kpi:hover {
    translate: 0 -2px;
    border-color: #b5d8ce;
    box-shadow: 0 6px 18px #244b3f0c;
  }
  .bar-row {
    border-radius: 6px;
    padding: 6px;
    margin: -6px;
    transition: background 0.16s;
  }
  .bar-row:hover {
    background: #eef7f3;
    color: #087f68;
  }
  .bar-row:hover .bar span {
    background: #087f68;
  }
}
@keyframes workspace-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes metric-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes chart-enter {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
@media (max-width: 820px) {
  #queue-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 16px;
    gap: 12px;
  }
  #queue-filters label,
  #queue-filters .field {
    min-width: 0;
  }
  .density-toggle {
    min-width: 40px;
    min-height: 44px;
    padding: 0 10px;
  }
  .density-toggle span {
    display: none;
  }
  .dashboard-recent .table-wrap table {
    min-width: 440px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .kpi:hover {
    translate: none;
  }
}
.crm-stats > .panel + .panel {
  margin-top: 0;
}
