:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-2: #eef4f5;
  --text: #1e252b;
  --muted: #66727d;
  --line: #dbe1e6;
  --accent: #116a5b;
  --accent-dark: #0d4f45;
  --accent-soft: #e1f2ee;
  --info: #2563eb;
  --info-soft: #e8f0ff;
  --amber: #946200;
  --amber-soft: #fff5da;
  --danger: #b42318;
  --warning: #946200;
  --shadow: 0 18px 44px rgba(30, 37, 43, 0.08), 0 4px 12px rgba(30, 37, 43, 0.04);
  --shadow-sm: 0 4px 6px -1px rgba(30, 37, 43, 0.05), 0 2px 4px -2px rgba(30, 37, 43, 0.04);
  --shadow-xs: 0 2px 5px rgba(30, 37, 43, 0.04);
  --radius-card: 8px;
  --radius-control: 12px;
  --radius-panel: 12px;
  --font-ui: "Noto Sans Myanmar", "Myanmar Sangam MN", "Myanmar MN", "Pyidaungsu", "Padauk", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: "Noto Sans Myanmar", "Myanmar Sangam MN", "Myanmar MN", "Pyidaungsu", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body-weight: 500;
  --font-heading-weight: 850;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html[data-font="myanmar"] {
  --font-ui: "Noto Sans Myanmar", "Myanmar Sangam MN", "Myanmar MN", "Myanmar Text", "Pyidaungsu", "Padauk", system-ui, sans-serif;
  --font-heading: "Noto Sans Myanmar", "Myanmar Sangam MN", "Myanmar MN", "Myanmar Text", "Pyidaungsu", "Padauk", system-ui, sans-serif;
  --font-body-weight: 500;
  --font-heading-weight: 820;
}

html[data-font="modern"] {
  --font-ui: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Noto Sans Myanmar", "Myanmar Sangam MN", "Myanmar MN", "Pyidaungsu", sans-serif;
  --font-heading: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Noto Sans Myanmar", "Myanmar Sangam MN", "Myanmar MN", "Pyidaungsu", sans-serif;
  --font-body-weight: 500;
  --font-heading-weight: 850;
}

html[data-font="compact"] {
  --font-ui: Arial, "Helvetica Neue", "Noto Sans Myanmar", "Myanmar Sangam MN", "Myanmar MN", "Myanmar Text", "Pyidaungsu", sans-serif;
  --font-heading: Arial, "Helvetica Neue", "Noto Sans Myanmar", "Myanmar Sangam MN", "Myanmar MN", "Myanmar Text", "Pyidaungsu", sans-serif;
  --font-body-weight: 500;
  --font-heading-weight: 800;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: var(--font-body-weight);
  font-feature-settings: "kern" 1;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

@keyframes micro-pop {
  0% {
    transform: scale(0.94);
  }
  55% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes micro-check {
  0% {
    opacity: 0;
    transform: scale(0.55) rotate(-8deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

.initial-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 24px;
  background: var(--bg);
  color: var(--text);
  text-align: center;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.initial-loader.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.initial-loader-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.initial-loader-mark span {
  width: 30px;
  height: 30px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: initial-loader-spin 760ms linear infinite;
}

.initial-loader strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.initial-loader p,
.noscript-warning {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.boot-error {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(238, 242, 245, 0.96);
}

.boot-error-card {
  width: min(430px, 100%);
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid rgba(180, 35, 24, 0.16);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.boot-error-card h2,
.boot-error-card p {
  margin: 0;
}

.boot-error-card h2 {
  font-size: 24px;
  line-height: 1.2;
}

.boot-error-card .button {
  width: 100%;
}

.noscript-warning {
  padding: 12px;
  text-align: center;
}

.app-shell {
  width: min(1280px, calc(100% - 20px));
  margin: 0 auto;
  padding: 10px 0 40px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(219, 225, 230, 0.86);
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.font-setting {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  max-width: 156px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #f7fafb;
  color: var(--text);
  padding: 6px 8px;
  box-shadow: var(--shadow-xs);
}

.font-setting > span {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 900;
  line-height: 1;
}

.font-setting select {
  min-width: 0;
  max-width: 96px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  outline: none;
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.refresh-status {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.topbar h1,
.panel h2,
.drawer h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: var(--font-heading-weight);
  line-height: 1.15;
}

.panel h2,
.drawer h2 {
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metrics.collapsed {
  display: none;
}

.ops-status-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-bottom: 10px;
  text-align: left;
}

.ops-status-toggle .ops-status-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ops-status-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark);
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.ops-status-toggle.warning {
  border-color: rgba(148, 98, 0, 0.24);
  background: var(--amber-soft);
  color: #7a3f00;
}

.ops-status-toggle.danger {
  border-color: rgba(180, 35, 24, 0.24);
  background: #fff1f0;
  color: var(--danger);
}

.ops-status-tray {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  animation: panel-in 160ms ease-out;
}

.ops-status-tray.hidden {
  display: none;
}

.ops-status-tray .sync-status-panel,
.ops-status-tray .source-data-alert-panel {
  margin-bottom: 0;
}

.sync-status-panel,
.source-data-alert-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.sync-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.sync-status-item,
.sync-source-row,
.sync-history-row,
.source-data-alert-row {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  padding: 10px;
  box-shadow: var(--shadow-xs);
}

.sync-status-item.active {
  border-color: rgba(17, 106, 91, 0.35);
  background: var(--accent-soft);
}

.sync-history-row.force {
  border-color: rgba(17, 106, 91, 0.35);
  background: #f0fbf7;
}

.sync-status-item.danger,
.source-data-alert-panel {
  border-color: rgba(180, 35, 24, 0.24);
}

.sync-status-item span,
.sync-source-head span,
.sync-status-item small,
.sync-source-row small,
.sync-history-row small,
.sync-history-row span,
.source-data-alert-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.sync-status-item strong,
.sync-source-row strong,
.sync-history-row strong,
.source-data-alert-row strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.sync-source-list,
.sync-history-list,
.source-data-alert-list {
  display: grid;
  gap: 8px;
}

.sync-status-actions {
  display: grid;
  gap: 7px;
  border: 1px solid rgba(17, 106, 91, 0.18);
  border-radius: var(--radius-card);
  background: var(--accent-soft);
  padding: 10px;
}

.sync-status-actions .button {
  width: 100%;
}

.sync-status-actions small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.sync-source-head,
.source-data-alert-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.source-data-alert-head h2 {
  margin: 0;
  font-size: 18px;
}

.source-data-alert-head > strong {
  color: var(--danger);
  font-size: 24px;
  line-height: 1;
}

.source-data-alert-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-data-alert-chips span {
  border: 1px solid rgba(180, 35, 24, 0.18);
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
}

.source-data-alert-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.source-data-alert-row span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.source-data-alert-link {
  min-height: 34px;
  padding: 8px 10px;
  font-size: 12px;
}

.metric {
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.workspace {
  display: block;
  min-width: 0;
}

.quick-access-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.quick-access-tab {
  justify-content: center;
  border-color: var(--line);
  background: #fff;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.menu-toggle {
  width: 100%;
  justify-content: center;
  margin: 0 0 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 28;
  background: rgba(15, 23, 30, 0.36);
}

.quick-filter-fab {
  width: 100%;
  justify-content: center;
  margin: 0 0 12px;
  min-height: 48px;
  border-color: rgba(17, 106, 91, 0.18);
  background: #fff;
  color: var(--accent-dark);
  font-weight: 900;
  box-shadow: var(--shadow-sm);
}

.quick-filter-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  visibility: hidden;
  background: rgba(15, 23, 30, 0.38);
  opacity: 0;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.quick-filter-backdrop.open {
  visibility: visible;
  opacity: 1;
}

.quick-filter-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 36;
  display: grid;
  align-content: start;
  gap: 14px;
  width: min(360px, 88vw);
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  padding: 16px;
  box-shadow: var(--shadow);
  transform: translateX(105%);
  transition: transform 200ms ease;
  -webkit-overflow-scrolling: touch;
}

.quick-filter-drawer.open {
  transform: translateX(0);
}

.quick-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.quick-filter-head h2 {
  margin: 0;
  font-size: 22px;
}

.quick-filter-group {
  display: grid;
  gap: 8px;
}

.quick-filter-group h3 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.quick-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-filter-chip {
  position: relative;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  padding: 8px 12px;
  font-weight: 900;
  overflow: hidden;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 120ms ease;
}

.quick-filter-chip:hover,
.quick-filter-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.quick-filter-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.view-tabs {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: grid;
  align-content: start;
  width: min(290px, 86vw);
  gap: 6px;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  transform: translateX(-105%);
  transition: transform 180ms ease;
}

.view-tabs.open {
  transform: translateX(0);
}

.side-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 10px;
}

.menu-category {
  display: grid;
  gap: 6px;
}

.menu-category + .menu-category {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.menu-category h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.menu-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--accent-dark);
  font-size: 12px;
  line-height: 1;
}

.menu-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  text-align: left;
  font-weight: 800;
  overflow: hidden;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 120ms ease;
}

.view-tab.active,
.button.secondary.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.view-tab.active .menu-icon,
.button.secondary.active .filter-icon {
  background: #fff;
  color: var(--accent-dark);
}

.view-tab:hover {
  background: #f5f8f9;
  color: var(--text);
}

.view-tab.active:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.view-panel {
  min-height: 180px;
  animation: panel-in 160ms ease-out;
}

@keyframes panel-in {
  from {
    opacity: 0.72;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes initial-loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes skeleton-pulse {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -80% 0;
  }
}

.panel-head,
.drawer-head,
.record-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-head {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.search-form,
.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 16px;
}

.search-form-with-mode {
  grid-template-columns: minmax(136px, 0.35fr) minmax(0, 1fr) auto;
}

.search-mode-label select {
  min-height: 52px;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(110px, 0.45fr) minmax(120px, 0.5fr) auto;
  gap: 10px;
  margin-top: 16px;
}

.table-filter-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.7fr) minmax(96px, 0.3fr) minmax(110px, 0.35fr) auto;
  gap: 10px;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(17, 106, 91, 0.14);
}

.button,
.icon-button {
  position: relative;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  padding: 10px 14px;
  font-weight: 700;
  overflow: hidden;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.button::after,
.icon-button::after,
.view-tab::after,
.quick-filter-chip::after,
.due-age-chip::after,
.count-chip::after,
.branch-count-chip::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 110%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  transition: opacity 180ms ease, transform 180ms ease;
}

.button:not(:disabled):hover,
.icon-button:not(:disabled):hover,
.view-tab:not(:disabled):hover,
.quick-filter-chip:not(:disabled):hover,
.due-age-chip:not(:disabled):hover,
.count-chip:not(:disabled):hover,
.branch-count-chip:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.button:not(:disabled):active::after,
.icon-button:not(:disabled):active::after,
.view-tab:not(:disabled):active::after,
.quick-filter-chip:not(:disabled):active::after,
.due-age-chip:not(:disabled):active::after,
.count-chip:not(:disabled):active::after,
.branch-count-chip:not(:disabled):active::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.button.primary {
  background: var(--accent);
  color: white;
}

.button.primary:hover {
  background: var(--accent-dark);
}

.button.danger {
  border-color: #f0b4ad;
  background: #fff1f0;
  color: var(--danger);
}

.button.danger:hover {
  border-color: var(--danger);
  background: #ffe3e0;
}

.button:not(:disabled):active,
.icon-button:not(:disabled):active,
.view-tab:not(:disabled):active,
.quick-filter-chip:not(:disabled):active,
.due-age-chip:not(:disabled):active,
.count-chip:not(:disabled):active,
.branch-count-chip:not(:disabled):active {
  transform: translateY(1px) scale(0.99);
  box-shadow: none;
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button.secondary,
.icon-button {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line);
}

.button.secondary:hover,
.icon-button:hover {
  border-color: #c7d3d8;
  background: #f7fafb;
}

.icon-button {
  width: 42px;
  padding: 0;
}

.line {
  margin-top: 12px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.record-list,
.due-sections,
.compare-sections,
.tracked-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.tracked-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.count-chip {
  position: relative;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 7px 11px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  transition: border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 120ms ease;
}

.count-chip:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.tracked-card {
  position: relative;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-card);
  background: #fff;
  padding: 12px;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.tracked-card.select-mode {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
}

.tracked-select,
.select-all-row input[type="checkbox"] {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 auto;
  margin-top: 4px;
  border: 2px solid #b7c5cc;
  border-radius: 6px;
  background: #fff;
  padding: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.tracked-select::after,
.select-all-row input[type="checkbox"]::after {
  content: "";
  width: 9px;
  height: 5px;
  border: 2px solid #fff;
  border-top: 0;
  border-right: 0;
  opacity: 0;
  transform: scale(0.55) rotate(-45deg);
}

.tracked-select:checked,
.select-all-row input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(17, 106, 91, 0.12);
}

.tracked-select:checked::after,
.select-all-row input[type="checkbox"]:checked::after {
  animation: micro-check 150ms ease both;
}

.tracked-select:active,
.select-all-row input[type="checkbox"]:active {
  transform: scale(0.92);
}

.tracked-select:focus-visible,
.select-all-row input[type="checkbox"]:focus-visible {
  outline: 3px solid rgba(17, 106, 91, 0.18);
  outline-offset: 2px;
}

.tracked-select.micro-pop,
.table-select-checkbox.micro-pop,
.select-all-row input[type="checkbox"].micro-pop,
.toggle-switch.micro-pop {
  animation: micro-pop 210ms ease;
}

.tracked-card.select-mode:has(.tracked-select:checked) {
  border-color: rgba(17, 106, 91, 0.42);
  box-shadow: 0 10px 26px rgba(17, 106, 91, 0.12);
}

.tracked-card-body {
  min-width: 0;
}

.optimistic-card {
  border-color: #c8d7dd;
  border-left-color: var(--info);
  background: #f8fbff;
  opacity: 0.82;
}

.tracked-settings {
  margin-bottom: 12px;
}

.toggle-row,
.select-all-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

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

.toggle-switch {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #cfd8df;
  transition: background 140ms ease;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(30, 37, 43, 0.2);
  transition: transform 140ms ease;
}

.toggle-row input:checked + .toggle-switch {
  background: var(--accent);
}

.toggle-row input:checked + .toggle-switch::after {
  transform: translateX(20px);
}

.bulk-bar {
  position: sticky;
  top: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
}

.tracked-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.tracked-head strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.tracked-type,
.tracked-open-count {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.tracked-open-count {
  flex: 0 0 auto;
  background: var(--surface-2);
  color: var(--muted);
  text-transform: none;
}

.tracked-lines {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.copy-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #f9fbfb;
  padding: 12px;
}

.copy-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.copy-panel h3 {
  margin: 2px 0 0;
  font-size: 17px;
  line-height: 1.25;
}

.copy-preview {
  max-height: 240px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--text);
  padding: 12px;
  font: 700 14px/1.5 inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.copy-preview.empty {
  color: var(--muted);
  font-weight: 600;
}

.agent-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.agent-scope-grid,
.agent-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.agent-scope-grid label {
  min-width: 0;
}

.agent-form textarea {
  min-height: 130px;
}

.agent-examples,
.agent-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.agent-suggestions .button {
  flex: 1 1 190px;
  min-width: 0;
  min-height: 42px;
  justify-content: center;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}

.agent-insights {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.agent-insight-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 8px;
}

.agent-insight-card,
.agent-evidence-group,
.agent-evidence-record {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.agent-insight-card {
  padding: 10px;
}

.agent-insight-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.agent-insight-card strong {
  display: block;
  margin-top: 2px;
  color: var(--accent-dark);
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.agent-insight-card p,
.agent-evidence-record span {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.agent-evidence-group {
  padding: 10px;
}

.agent-evidence-group h3 {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.35;
}

.agent-evidence-record {
  display: grid;
  gap: 3px;
  padding: 9px;
}

.agent-evidence-record + .agent-evidence-record {
  margin-top: 7px;
}

.agent-evidence-record strong {
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.agent-answer {
  min-height: 160px;
  max-height: 520px;
  margin: 12px 0 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #f9fbfb;
  color: var(--text);
  padding: 14px;
  font: 700 14px/1.55 inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.agent-answer.empty {
  color: var(--muted);
  font-weight: 600;
}

.priority-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.due-age-block {
  display: grid;
  gap: 12px;
}

.due-control-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.due-control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.due-control {
  display: grid;
  gap: 5px;
}

.due-control span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.due-filter-select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  padding: 8px 10px;
  color: var(--text);
  font-weight: 850;
  box-shadow: var(--shadow-xs);
}

.due-compact-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.due-compact-stats span,
.due-aging-stat {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  padding: 8px 10px;
  box-shadow: var(--shadow-xs);
}

.due-compact-stats strong,
.due-aging-stat strong {
  display: block;
  overflow: hidden;
  color: var(--accent-dark);
  font-size: 18px;
  font-weight: 950;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.due-compact-stats small,
.due-aging-stat small,
.due-aging-stat span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.due-visual-overview {
  container-type: inline-size;
  contain: inline-size;
  display: grid;
  gap: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, #ffffff 0%, #f7fbfa 100%);
  padding: 12px;
  box-shadow: var(--shadow-xs);
}

.date-range-visual-overview {
  grid-column: 1 / -1;
}

.source-audit-panel {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
}

.source-audit-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.source-audit-stats span {
  display: grid;
  gap: 2px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.82);
  padding: 8px;
  box-shadow: var(--shadow-xs);
}

.source-audit-stats strong {
  color: var(--accent-dark);
  font-size: 17px;
  font-weight: 950;
  line-height: 1;
}

.source-audit-stats small {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.source-audit-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  min-width: 0;
}

.source-audit-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  padding: 7px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
}

.source-audit-chip:hover,
.source-audit-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: var(--shadow-sm);
}

.source-audit-chip span:not(.due-chart-swatch) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.source-audit-chip strong {
  color: var(--text);
  font-weight: 950;
}

.source-audit-drilldown {
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: inset 3px 0 0 #2563eb, var(--shadow-xs);
}

.source-audit-preview-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.source-audit-preview-record,
.source-audit-duplicate-row {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.source-audit-main-row {
  min-height: 0;
}

.source-audit-text-row {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  padding: 8px 10px;
  box-shadow: var(--shadow-xs);
}

.source-audit-text-row strong,
.source-audit-text-row span,
.source-audit-text-row small,
.source-audit-duplicate-row > strong,
.source-audit-duplicate-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.source-audit-text-row strong,
.source-audit-duplicate-row > strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
  line-height: 1.25;
}

.source-audit-text-row span,
.source-audit-duplicate-row > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.source-audit-text-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.35;
}

.source-audit-row-link {
  justify-self: start;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.source-audit-warning-row .source-audit-text-row {
  border-color: #fecaca;
  background: #fff7f7;
}

.source-audit-duplicate-row {
  border: 1px solid rgba(124, 58, 237, 0.18);
  border-radius: var(--radius-card);
  background: rgba(124, 58, 237, 0.05);
  padding: 9px;
}

.due-visual-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 10px;
  min-width: 0;
}

.due-visual-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 950;
  line-height: 1.25;
}

.due-visual-head span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.due-visual-grid {
  display: grid;
  grid-template-columns: minmax(112px, 140px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.due-visual-button {
  appearance: none;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(15, 118, 110, 0.12);
  transition: background 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.due-visual-button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 3px;
}

.due-visual-button:active {
  transform: scale(0.98);
}

.due-visual-button.active {
  color: var(--accent-dark);
}

.due-visual-donut-button {
  display: grid;
  place-items: center;
  justify-self: center;
}

.due-donut {
  display: grid;
  place-items: center;
  width: min(132px, 42vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(#0f766e 0deg 360deg);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.14);
}

.due-donut-center {
  display: grid;
  place-items: center;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  text-align: center;
  box-shadow: inset 0 0 0 1px var(--line), 0 4px 12px rgba(15, 23, 42, 0.07);
}

.due-donut-center strong {
  color: var(--accent-dark);
  font-size: 22px;
  font-weight: 950;
  line-height: 1;
}

.due-donut-center span {
  padding: 0 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.15;
}

.due-chart-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  min-width: 0;
}

.due-chart-legend-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  padding: 6px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
}

.due-chart-legend-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: var(--shadow-sm);
}

.due-chart-legend-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.due-chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.due-chart-legend-item span:not(.due-chart-swatch) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.due-chart-legend-item strong {
  color: var(--text);
  font-weight: 950;
}

.due-visual-bars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.due-visual-bar-section {
  display: grid;
  gap: 8px;
  min-width: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  padding: 9px;
}

.due-visual-bar-section h4 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  line-height: 1.2;
}

.due-visual-bar-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.due-visual-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
  min-width: 0;
}

.due-visual-bar-row.due-visual-button {
  width: 100%;
  border-radius: 10px;
  padding: 4px;
}

.due-visual-bar-row.due-visual-button:hover {
  background: rgba(15, 118, 110, 0.06);
}

.due-visual-bar-row.due-visual-button.active {
  background: rgba(15, 118, 110, 0.1);
}

.due-visual-bar-label {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.due-visual-bar-row strong {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 950;
}

.due-visual-bar-track {
  grid-column: 1 / -1;
  display: block;
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: #e8eef1;
}

.due-section-bar-fill,
.due-branch-bar-fill,
.due-timeline-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 260ms ease;
}

.due-section-bar-fill {
  background: #64748b;
}

.due-branch-bar-fill {
  background: #0f766e;
}

.due-timeline-bar-fill {
  background: #2563eb;
}

.due-visual-empty {
  margin: 0;
  font-size: 12px;
}

.due-visual-drilldown {
  display: grid;
  gap: 9px;
  overflow: hidden;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.88);
  padding: 10px;
  box-shadow: inset 3px 0 0 var(--accent), var(--shadow-xs);
  animation: due-drilldown-in 180ms ease;
}

.due-visual-drilldown-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 8px;
  min-width: 0;
}

.due-visual-drilldown-head h4 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 950;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.due-visual-drilldown-head span {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.due-visual-drilldown p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.due-visual-drilldown-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.due-visual-mini-action {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.due-visual-preview-list {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.due-visual-preview-row {
  display: grid;
  gap: 3px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  text-align: left;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.due-visual-preview-row:hover {
  border-color: var(--accent);
  background: #f7fbfa;
  box-shadow: var(--shadow-sm);
}

.due-visual-preview-row:active {
  transform: scale(0.99);
}

.due-visual-preview-row strong,
.due-visual-preview-row span,
.due-visual-preview-row small {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.due-visual-preview-row strong {
  font-size: 13px;
  font-weight: 950;
  line-height: 1.25;
}

.due-visual-preview-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.due-visual-preview-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.35;
}

.due-visual-preview-row.issue {
  border-color: #fed7aa;
  background: #fffaf3;
}

.due-visual-preview-row:disabled {
  cursor: default;
  opacity: 0.78;
}

@keyframes due-drilldown-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

[data-due-visual-target],
[data-date-range-visual-target],
[data-due-date-group] {
  scroll-margin-top: 92px;
}

.due-visual-target-pulse {
  animation: due-target-pulse 900ms ease;
}

@keyframes due-target-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.26), var(--shadow-xs);
  }

  100% {
    box-shadow: 0 0 0 12px rgba(15, 118, 110, 0), var(--shadow-xs);
  }
}

@container (max-width: 520px) {
  .due-visual-grid,
  .due-visual-bars,
  .due-chart-legend,
  .source-audit-stats,
  .source-audit-chips {
    grid-template-columns: 1fr;
  }

  .due-donut {
    justify-self: center;
    width: 124px;
  }
}

.due-data-issues {
  border: 1px solid #fed7aa;
  border-radius: var(--radius-card);
  background: #fff7ed;
  padding: 10px;
  box-shadow: var(--shadow-xs);
}

.due-data-issues summary {
  color: #9a3412;
  font-weight: 950;
  cursor: pointer;
}

.due-data-issue-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.due-data-issue {
  display: grid;
  gap: 3px;
  border-radius: 12px;
  background: #fff;
  padding: 8px 10px;
}

.due-data-issue strong {
  color: #7c2d12;
  font-weight: 950;
}

.due-data-issue span,
.due-data-issue small {
  color: #7c2d12;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.due-data-issue small {
  color: var(--muted);
}

.due-excluded-reasons {
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-card);
  background: #f8fafc;
  padding: 10px;
  box-shadow: var(--shadow-xs);
}

.due-excluded-reasons summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #334155;
  cursor: pointer;
  font-weight: 950;
}

.due-excluded-reasons summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.due-excluded-reason-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.due-excluded-submenu {
  align-items: center;
}

.due-excluded-reason-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #dbe3ea;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 120ms ease;
}

.due-excluded-reason-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: var(--shadow-sm);
}

.due-excluded-reason-chip:active {
  transform: scale(0.98);
}

.due-excluded-reason-chip strong {
  color: var(--accent-dark);
  font-size: 15px;
}

.due-excluded-reason-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.due-excluded-empty {
  margin: 0;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--muted);
  padding: 10px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.due-excluded-reason-group {
  display: grid;
  gap: 6px;
  border-radius: var(--radius-card);
  background: #fff;
  padding: 9px;
}

.due-excluded-reason-group h4 {
  margin: 0;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.25;
}

.due-excluded-ticket {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  text-align: left;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.due-excluded-ticket:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.due-excluded-ticket:active {
  transform: scale(0.99);
}

.due-excluded-ticket strong,
.due-excluded-ticket span {
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  word-break: break-word;
}

.due-excluded-ticket strong {
  font-size: 14px;
  font-weight: 950;
}

.due-excluded-ticket span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.due-early-resolved {
  border-left: 4px solid #2563eb;
  border-radius: var(--radius-card);
  background: #eff6ff;
  padding: 10px;
}

.due-supplement-section {
  gap: 8px;
  contain: inline-size;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
}

.due-supplement-section,
.due-supplement-section * {
  box-sizing: border-box;
}

.due-supplement-section > .section-title {
  margin: 0;
  max-width: 100%;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.due-supplement-section > .muted {
  margin: 0;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.due-supplement-section .record-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 10px;
}

.due-supplement-section .record-title {
  min-height: 0;
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.due-supplement-section .compact-record-card .record-title {
  display: block;
  min-height: 0;
  -webkit-line-clamp: unset;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.due-supplement-section .record-meta,
.due-supplement-section .record-details,
.due-supplement-section .extra-line {
  font-size: 12px;
  line-height: 1.35;
}

.due-supplement-section .compact-record-card .record-meta {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.due-supplement-section .compact-record-card:not(.expanded) .record-details .compact-line {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  white-space: normal;
}

.due-supplement-section .record-actions .button {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 13px;
}

.due-record-card.compact-record-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.due-record-card .record-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.due-record-card .record-main > div {
  min-width: 0;
  width: 100%;
}

.due-record-card.compact-record-card .record-title {
  display: block;
  min-height: 0;
  -webkit-line-clamp: unset;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  word-break: break-word;
}

.due-record-card.compact-record-card .record-meta {
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  word-break: break-word;
}

.due-record-card .status-pill {
  justify-self: start;
  max-width: 100%;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  word-break: break-word;
}

.due-record-card.compact-record-card:not(.expanded) .record-details .compact-line {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-word;
}

.due-early-resolved > .section-title {
  color: #1d4ed8;
}

.due-not-due-yet {
  border-left: 4px solid #f59e0b;
  border-radius: var(--radius-card);
  background: #fffbeb;
  padding: 10px;
}

.due-not-due-yet > .section-title,
.not-due-yet-reason {
  color: #92400e;
}

.due-sheet-month {
  border-left: 4px solid #7c3aed;
  border-radius: var(--radius-card);
  background: #f5f3ff;
  padding: 10px;
}

.due-sheet-month > .section-title,
.sheet-month-reason {
  color: #5b21b6;
}

.early-resolved-reason {
  color: #1d4ed8;
  font-weight: 850;
}

.due-aging-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.due-aging-stat.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.due-filter-details,
.branch-count-details {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  padding: 8px 10px;
  box-shadow: var(--shadow-xs);
}

.due-filter-details summary,
.branch-count-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

.branch-count-details summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.due-age-summary {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to right, #000 calc(100% - 42px), transparent);
  padding-bottom: 4px;
}

.due-age-chip {
  position: relative;
  display: grid;
  gap: 4px;
  flex: 0 0 min(230px, 76vw);
  min-width: 170px;
  scroll-snap-align: start;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-card);
  background: #fff;
  padding: 10px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  overflow: hidden;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.due-age-chip:hover {
  border-color: var(--accent);
  background: #f7fbfa;
}

.due-age-chip.active {
  border-color: var(--accent);
  background: #e8f6f2;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.16);
}

.due-age-chip:active {
  transform: translateY(1px);
}

.due-age-chip strong,
.due-age-chip span {
  line-height: 1.15;
}

.due-age-chip span {
  color: var(--accent-dark);
  font-size: 22px;
  font-weight: 900;
}

.due-age-chip em {
  width: fit-content;
  border-radius: 999px;
  background: #fff7ed;
  padding: 2px 7px;
  color: #9a3412;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.due-age-chip small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.due-note-filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to right, #000 calc(100% - 42px), transparent);
  padding-bottom: 4px;
}

.due-note-filter {
  flex: 0 0 auto;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--soft);
  padding: 8px 12px;
  color: var(--muted);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.due-note-filter.active {
  border-color: var(--accent);
  background: #e8f6f2;
  color: var(--accent-dark);
}

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

.stuck-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fff;
  padding: 14px;
}

.stuck-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stuck-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.2;
}

.stuck-count {
  min-width: 54px;
  border-radius: var(--radius-control);
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 8px 10px;
  text-align: center;
  font-size: 24px;
  line-height: 1;
}

.stuck-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stuck-stats span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.stuck-tickets {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.stuck-records {
  display: grid;
  gap: 6px;
}

.stuck-record {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: #fbfcfc;
  color: var(--text);
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.stuck-record:hover {
  border-color: var(--accent);
  background: #f7fbfa;
}

.priority-section {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.record-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  padding: 14px;
  box-shadow: 0 4px 12px rgba(30, 37, 43, 0.04);
  overflow: hidden;
}

.record-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  content: "";
}

.record-card:hover {
  border-color: #c9d7dc;
}

.record-title {
  font-size: 17px;
  font-weight: 800;
}

.record-meta,
.record-details {
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.record-meta {
  margin-top: 4px;
  font-size: 13px;
}

.record-details {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  font-size: 14px;
}

.record-card:not(.expanded) .record-details .extra-line {
  display: none;
}

.record-card:not(.expanded) .record-details .note-line {
  display: none;
}

.record-card.expanded .record-details .extra-line,
.record-card.expanded .record-details .note-line {
  display: block;
}

.compact-record-card {
  padding: 12px 12px 12px 14px;
}

.compact-record-card .record-title {
  display: -webkit-box;
  min-height: 42px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.table-record-card .record-title {
  font-size: 20px;
}

.table-record-card .record-meta {
  font-size: 13px;
}

.compact-record-card .record-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-record-card .record-details {
  gap: 3px;
  margin-top: 8px;
}

.compact-record-card:not(.expanded) .record-details .extra-line,
.compact-record-card:not(.expanded) .record-details .note-line {
  display: none;
}

.compact-record-card:not(.expanded) .record-details .compact-line {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}

.compact-record-card .note-summary-line {
  color: var(--accent-dark);
  font-weight: 700;
}

.compact-record-card:not(.expanded) .record-details .matched-identifier-line,
.compact-record-card .matched-identifier-line {
  display: block;
  color: var(--accent-dark);
  font-weight: 700;
  line-height: 1.45;
  overflow: visible;
  overflow-wrap: anywhere;
  white-space: normal;
  -webkit-line-clamp: unset;
}

.note-center-tabs {
  margin: 12px 0 4px;
}

.sheet-field-line {
  color: var(--muted);
}

.record-details .risk-line {
  color: #9a3412;
  font-weight: 800;
}

.status-pill {
  flex: 0 0 auto;
  max-width: 150px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-dark);
  background: #e6f3ef;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill.warn {
  color: var(--warning);
  background: var(--amber-soft);
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.record-actions .button.action-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.record-actions .button.action-primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.record-actions .button.action-success {
  border-color: rgba(17, 106, 91, 0.22);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.record-actions .button.action-secondary {
  border-color: rgba(37, 99, 235, 0.16);
  background: var(--info-soft);
  color: #1d4ed8;
}

.record-actions .button.action-quiet {
  border-color: var(--line);
  background: #f7fafb;
  color: var(--muted);
}

.compact-record-card .record-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.compact-record-card .record-actions .button {
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
}

.compact-record-card:not(.expanded) .edit-note-action {
  display: none;
}

.due-record-card:not(.expanded) .record-actions {
  grid-template-columns: 1fr;
}

.due-record-card:not(.expanded) .detail-action,
.due-record-card:not(.expanded) .note-action,
.due-record-card:not(.expanded) .edit-note-action,
.due-record-card:not(.expanded) .three-month-status-action {
  display: none;
}

.section-block {
  display: grid;
  gap: 10px;
}

.section-title {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.3;
}

.branch-counts {
  margin-top: 12px;
}

.branch-count-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.branch-count-chip {
  position: relative;
  display: grid;
  grid-template-columns: minmax(46px, auto) auto;
  gap: 2px 8px;
  min-height: 50px;
  max-width: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  text-align: left;
  overflow: hidden;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.branch-count-chip:hover {
  border-color: var(--accent);
  background: #f7fbfa;
}

.branch-count-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.due-branch-clear {
  width: fit-content;
  min-height: 36px;
  margin-top: 8px;
  padding: 7px 10px;
  font-size: 13px;
}

.branch-count-chip strong,
.branch-count-chip span {
  font-size: 15px;
  line-height: 1.2;
}

.branch-count-chip span {
  color: var(--accent-dark);
  font-weight: 900;
}

.branch-count-chip small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-filters {
  position: relative;
  display: grid;
  margin-top: 12px;
  overflow: visible;
  padding-bottom: 0;
}

.saved-filter-menu {
  position: relative;
  width: min(100%, 360px);
}

.saved-filter-trigger {
  width: 100%;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
}

.saved-filter-current {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.saved-filter-current span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-filter-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  transition: transform 140ms ease;
}

.saved-filter-menu.open .saved-filter-chevron {
  transform: rotate(180deg);
}

.saved-filter-submenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 14;
  display: grid;
  width: min(360px, calc(100vw - 56px));
  max-height: 280px;
  overflow-y: auto;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.98);
  padding: 6px;
  box-shadow: var(--shadow);
}

.saved-filter-submenu[hidden] {
  display: none;
}

.saved-filter-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text);
  padding: 9px 10px;
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.saved-filter-menu-item:hover {
  border-color: var(--line);
  background: #f7fafb;
}

.saved-filter-menu-item.active {
  border-color: rgba(17, 106, 91, 0.2);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.filter-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 5px;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.saved-filter.active {
  background: #dcefeb;
  border-color: var(--accent);
  color: var(--accent-dark);
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.due-report-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.due-report-toolbar .button {
  min-width: 150px;
}

.table-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.dashboard-stat,
.chart-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: #fff;
  padding: 10px;
  box-shadow: var(--shadow-xs);
}

.dashboard-stat span,
.chart-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.dashboard-stat strong {
  display: block;
  margin-top: 4px;
  color: var(--accent-dark);
  font-size: 24px;
  line-height: 1;
}

.chart-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(74px, 0.7fr) minmax(90px, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
}

.chart-row span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.chart-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.bulk-status-label {
  display: flex;
  align-items: center;
  grid-template-columns: none;
  gap: 8px;
}

.bulk-status-label select {
  min-width: 150px;
}

.table-select-column {
  width: 62px;
  text-align: center;
}

.table-select-checkbox,
.select-all-row input[type="checkbox"] {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 auto;
  border: 2px solid #b7c5cc;
  border-radius: 6px;
  background: #fff;
  padding: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.table-select-checkbox::after,
.select-all-row input[type="checkbox"]::after {
  content: "";
  width: 9px;
  height: 5px;
  border: 2px solid #fff;
  border-top: 0;
  border-right: 0;
  opacity: 0;
  transform: scale(0.55) rotate(-45deg);
}

.table-select-checkbox:checked,
.select-all-row input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(17, 106, 91, 0.12);
}

.table-select-checkbox:checked::after,
.select-all-row input[type="checkbox"]:checked::after {
  animation: micro-check 150ms ease both;
}

.table-select-checkbox:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.record-card.select-mode {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
}

.record-card.select-mode .record-details,
.record-card.select-mode .record-actions {
  grid-column: 2;
}

.star-action.active {
  background: var(--amber-soft);
  border-color: #e0b955;
  color: var(--amber);
}

.table-wrap {
  width: 100%;
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  display: none;
}

.table-card-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.data-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.35;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7faf9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.data-table th:first-child,
.data-table td:first-child,
.data-table th:nth-child(2),
.data-table td:nth-child(2) {
  position: sticky;
  z-index: 2;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
}

.data-table th:first-child,
.data-table td:first-child {
  left: 0;
  min-width: 62px;
  max-width: 62px;
}

.data-table th:nth-child(2),
.data-table td:nth-child(2) {
  left: 62px;
  min-width: 130px;
  max-width: 170px;
}

.data-table th:first-child {
  z-index: 3;
  background: #f7faf9;
}

.data-table th:nth-child(2) {
  z-index: 3;
  background: #f7faf9;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: #f9fbfb;
}

.data-table tbody tr:hover td:first-child,
.data-table tbody tr:hover td:nth-child(2) {
  background: #f9fbfb;
}

.ticket-cell {
  font-weight: 800;
  white-space: nowrap;
}

.table-muted {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.note-cell {
  max-width: 260px;
}

.note-cell div {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.table-actions {
  min-width: 210px;
}

.table-actions .button {
  min-height: 34px;
  margin: 0 6px 6px 0;
  padding: 6px 10px;
  font-size: 13px;
}

.empty-table {
  color: var(--muted);
  text-align: center;
}

.table-skeleton-row td {
  height: 58px;
}

.table-card-skeleton {
  display: grid;
  gap: 10px;
  min-height: 120px;
}

.skeleton-line {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e7edf1 0%, #f6f8fa 45%, #e7edf1 100%);
  background-size: 180% 100%;
  animation: skeleton-pulse 1.1s ease-in-out infinite;
}

.skeleton-line-1 {
  width: 82%;
}

.skeleton-line-2 {
  width: 64%;
}

.skeleton-line-3 {
  width: 46%;
}

.drawer {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: flex-end;
  background: rgba(15, 23, 30, 0.44);
  z-index: 20;
}

.drawer.open {
  display: flex;
}

.undo-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(420px, calc(100vw - 28px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.undo-toast span {
  color: var(--text);
  font-weight: 800;
}

.drawer-panel {
  width: min(620px, 100%);
  height: 100%;
  overflow: auto;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}

.note-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.detail-body {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.detail-block {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(130px, 0.45fr) minmax(0, 1fr);
  gap: 8px 12px;
  line-height: 1.45;
}

.detail-grid dt {
  color: var(--muted);
  font-weight: 700;
}

.detail-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.note-history-list {
  display: grid;
  gap: 10px;
}

.note-history-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface-soft);
  padding: 10px 12px;
}

.note-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  color: var(--muted);
  font-size: 0.9rem;
}

.note-history-meta strong {
  color: var(--text);
}

.note-history-item p {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}

@media (min-width: 960px) {
  .table-wrap {
    display: block;
  }

  .table-card-list {
    display: none;
  }

  .due-note-filters {
    flex-wrap: wrap;
    overflow-x: visible;
    mask-image: none;
    padding-bottom: 0;
  }

  .due-age-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow-x: visible;
    mask-image: none;
    padding-bottom: 0;
  }

  .due-age-chip {
    min-width: 0;
    width: 100%;
  }

  .app-shell {
    padding-top: 14px;
  }

  .topbar {
    top: 10px;
  }

  main {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
  }

  .metrics,
  #authPanel,
  .ops-status-toggle,
  .ops-status-tray,
  .sync-status-panel,
  .source-data-alert-panel,
  .quick-access-tabs,
  .quick-filter-fab {
    grid-column: 1 / -1;
  }

  .menu-toggle,
  .menu-backdrop {
    display: none;
  }

  .view-tabs {
    position: sticky;
    inset: auto;
    top: 104px;
    z-index: 4;
    width: auto;
    min-height: calc(100dvh - 126px);
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-sm);
    transform: none;
  }

  .side-menu-head {
    padding: 2px 4px 10px;
    border-bottom: 1px solid var(--line);
  }

  .menu-category:first-of-type {
    margin-top: 4px;
  }

  #menuCloseBtn {
    display: none;
  }

  .view-tab {
    width: 100%;
    border-color: transparent;
    background: #fff;
  }

  .view-tab.active {
    box-shadow: inset 3px 0 0 var(--accent);
  }

  .panel {
    padding: 20px;
  }
}

@media (min-width: 1320px) {
  .quick-filter-fab,
  .quick-filter-backdrop,
  #quickFilterCloseBtn {
    display: none;
  }

  .quick-filter-drawer {
    top: 104px;
    right: 16px;
    bottom: auto;
    z-index: 7;
    width: 260px;
    max-height: calc(100dvh - 124px);
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    box-shadow: var(--shadow-sm);
    transform: none;
  }

  .app-shell {
    margin-left: max(10px, calc((100vw - 1280px) / 2));
    margin-right: 292px;
  }
}

@media (max-width: 880px) {
  .app-shell {
    width: min(100% - 16px, 760px);
    padding-top: 8px;
  }

  .topbar {
    position: relative;
    align-items: flex-start;
    min-height: auto;
    padding: 12px;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .topbar-actions .button {
    min-height: 40px;
    padding: 8px 12px;
  }

  .font-setting {
    flex: 1 1 136px;
    max-width: none;
  }

  .refresh-status {
    flex-basis: 100%;
    white-space: normal;
    text-align: right;
  }

  .menu-toggle {
    position: sticky;
    top: 8px;
    z-index: 8;
    justify-content: center;
    min-height: 48px;
  }

  .view-tabs {
    width: min(320px, 88vw);
    gap: 8px;
    padding: 16px;
    border-radius: 0 var(--radius-control) var(--radius-control) 0;
  }

  .quick-access-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view-tab {
    border-color: var(--line);
    background: #fff;
  }

  .metrics,
  .workspace,
  .table-dashboard,
  .due-control-grid,
  .due-compact-stats,
  .filter-grid,
  .table-filter-grid,
  .priority-grid,
  .stuck-grid {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-toolbar,
  .bulk-bar {
    align-items: stretch;
  }

  .table-toolbar .button,
  .bulk-bar .button,
  .bulk-status-label {
    flex: 1 1 150px;
  }

  .search-form,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .sync-status-grid,
  .search-form-with-mode,
  .source-data-alert-row {
    grid-template-columns: 1fr;
  }

  .source-data-alert-link {
    width: 100%;
  }

  .agent-scope-grid,
  .agent-actions {
    grid-template-columns: 1fr;
  }

  .agent-examples .button,
  .agent-suggestions .button {
    width: 100%;
  }

  .view-tab {
    min-height: 46px;
  }

  .panel {
    padding: 14px;
  }

  .panel-head {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

  .record-card {
    padding: 12px;
  }

  .record-title {
    font-size: 16px;
  }

  .table-wrap {
    margin-left: -8px;
    width: calc(100% + 16px);
    border-radius: 0;
  }
}

@media (max-width: 460px) {
  .topbar {
    display: grid;
    gap: 10px;
  }

  .topbar-actions {
    align-items: center;
    justify-content: stretch;
  }

  .topbar-actions .button {
    flex: 1 1 90px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .metrics {
    grid-template-columns: 1fr;
  }
}

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

  .button:not(:disabled):hover,
  .icon-button:not(:disabled):hover,
  .view-tab:not(:disabled):hover,
  .quick-filter-chip:not(:disabled):hover,
  .due-age-chip:not(:disabled):hover,
  .count-chip:not(:disabled):hover,
  .branch-count-chip:not(:disabled):hover,
  .button:not(:disabled):active,
  .icon-button:not(:disabled):active,
  .view-tab:not(:disabled):active,
  .quick-filter-chip:not(:disabled):active,
  .due-age-chip:not(:disabled):active,
  .count-chip:not(:disabled):active,
  .branch-count-chip:not(:disabled):active {
    transform: none;
  }
}
