:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-muted: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --warning: #b54708;
  --ok: #027a48;
  --shadow: 0 12px 35px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  background: #101828;
  color: #fff;
  padding: 24px 16px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #14b8a6;
  color: #05201d;
  font-weight: 800;
}

.brand-title {
  font-size: 17px;
  font-weight: 750;
}

.brand-subtitle {
  margin-top: 2px;
  color: #98a2b3;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 22px;
}

.nav-item {
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.main {
  min-width: 0;
  padding: 24px 28px 40px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.section-tabs {
  display: flex;
  gap: 4px;
  min-height: 42px;
  margin-bottom: 18px;
  padding-bottom: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.section-tabs.single {
  display: none;
}

.section-tab {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.section-tab:hover {
  background: #e8edee;
  color: var(--text);
}

.section-tab.active {
  background: #d9eeeb;
  color: var(--accent-dark);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

.key-panel,
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

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

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.14);
}

.key-panel input {
  width: 320px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

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

.workbench {
  display: grid;
  gap: 18px;
}

.workbench-partial-warning {
  padding: 10px 12px;
  border-left: 3px solid var(--warning);
  background: #fff7ed;
  color: #7c2d12;
  font-size: 13px;
}

.workbench-heading,
.workbench-queue header,
.workbench-connections header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.workbench-heading h2,
.workbench-queue h2,
.workbench-connections h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.workbench-heading p,
.workbench-queue header p {
  margin-top: 4px;
  font-size: 13px;
}

.workbench-updated {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.workbench-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.case-candidates {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.case-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.case-section-header h2 {
  margin: 0;
  font-size: 16px;
}

.case-section-header p {
  font-size: 13px;
}

.case-candidate-count {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 26px;
  border-radius: 6px;
  background: #fff4e5;
  color: var(--warning);
  font-size: 13px;
  font-weight: 800;
}

.case-section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.case-candidate-list {
  display: grid;
}

.case-candidate-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 98px;
  min-width: 0;
  padding: 14px 18px;
  border-bottom: 1px solid #eaecf0;
}

.case-candidate-item:last-child {
  border-bottom: 0;
}

.case-candidate-item.editing {
  display: block;
  background: #f8fafc;
}

.case-candidate-main,
.case-candidate-meta {
  min-width: 0;
}

.case-candidate-title,
.case-candidate-meta,
.case-candidate-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.case-candidate-title strong {
  font-size: 15px;
}

.case-candidate-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.case-candidate-group {
  margin-top: 7px;
  font-size: 12px;
}

.case-candidate-actions {
  justify-content: flex-end;
}

.case-candidate-form.form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.candidate-form-actions {
  grid-column: span 4;
}

.danger-text {
  color: var(--danger);
}

.workbench-task-card {
  display: grid;
  grid-template-rows: auto 44px minmax(42px, auto) auto;
  min-width: 0;
  min-height: 158px;
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 3px solid #98a2b3;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  white-space: normal;
}

.workbench-task-card:hover {
  border-color: #98a2b3;
  background: var(--panel-muted);
}

.workbench-task-card.warning {
  border-top-color: #f79009;
}

.workbench-task-card.danger {
  border-top-color: #d92d20;
}

.workbench-task-card.clear {
  border-top-color: #12b76a;
}

.workbench-task-label {
  color: #475467;
  font-size: 13px;
  font-weight: 700;
}

.workbench-task-card strong {
  align-self: center;
  font-size: 28px;
  line-height: 1;
}

.workbench-task-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.workbench-task-action,
.queue-action {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.workbench-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.75fr);
  gap: 14px;
  align-items: start;
}

.workbench-queue,
.workbench-connections {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.workbench-queue > header,
.workbench-connections > header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.workbench-queue-list {
  display: grid;
}

.workbench-queue-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) minmax(135px, auto) 42px;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 18px;
  border-bottom: 1px solid #eaecf0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  white-space: normal;
}

.workbench-queue-row:last-child {
  border-bottom: 0;
}

.workbench-queue-row:hover {
  background: var(--panel-muted);
}

.queue-file,
.queue-detail,
.queue-time {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-file {
  font-weight: 700;
}

.queue-detail,
.queue-time {
  color: var(--muted);
  font-size: 12px;
}

.workbench-empty {
  display: grid;
  gap: 5px;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.workbench-empty strong {
  color: var(--text);
}

.workbench-connection {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 10px 16px;
  border-bottom: 1px solid #eaecf0;
}

.workbench-connection:last-child {
  border-bottom: 0;
}

.workbench-connection > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.workbench-connection strong,
.workbench-connection span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-connection > div span {
  color: var(--muted);
  font-size: 11px;
}

.connection-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
}

.connection-dot.ok {
  background: var(--ok);
}

.connection-dot.warning {
  background: var(--warning);
}

.connection-status {
  color: var(--danger);
  font-size: 11px;
  font-weight: 700;
}

.connection-status.ok {
  color: var(--ok);
}

.connection-status.warning {
  color: var(--warning);
}

button.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

button.ghost:hover {
  background: var(--panel-muted);
}

button.danger-button {
  background: var(--danger);
}

.button-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

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

.button-like.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.button-like.ghost:hover {
  background: var(--panel-muted);
}

.alert {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #fedf89;
  background: #fffaeb;
  color: #7a2e0e;
}

.alert.error {
  border-color: #fecdca;
  background: #fffbfa;
  color: var(--danger);
}

.hidden {
  display: none;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid > * {
  min-width: 0;
}

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

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

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

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 750;
}

.panel-body {
  padding: 18px;
}

.stat {
  padding: 18px;
}

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

.stat-value {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 800;
}

.stat-help {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.capture-only-note {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid #b8d8d3;
  border-radius: 6px;
  background: #f1faf8;
}

.capture-only-note strong {
  flex: 0 0 auto;
  color: #0b6157;
}

.capture-only-note span {
  color: #475467;
  font-size: 13px;
}

.status-ok {
  color: var(--ok);
}

.status-warning {
  color: var(--warning);
}

.status-error {
  color: var(--danger);
}

.stat-note {
  min-height: 34px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.sender-account-login {
  max-width: 880px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sender-account-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.sender-account-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 8px;
  background: #2f80ed;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.sender-account-heading h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.sender-account-state {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.sender-state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.sender-state-dot.online {
  background: var(--ok);
}

.sender-state-dot.warning {
  background: var(--warning);
}

.sender-state-dot.error {
  background: var(--danger);
}

.platform-console {
  max-width: 1080px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.platform-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(47, 128, 237, 0.06)),
    #fff;
}

.platform-hero-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.platform-hero-mark {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  border-radius: 8px;
  background: #0f766e;
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
}

.platform-hero h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.platform-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.platform-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  background: #fff;
  color: #344054;
  font-size: 12px;
  font-weight: 750;
}

.platform-pill.ready {
  border-color: #abefc6;
  background: #ecfdf3;
  color: var(--ok);
}

.platform-pill.warn,
.platform-pill.mock {
  border-color: #fedf89;
  background: #fffaeb;
  color: var(--warning);
}

.platform-pill.live {
  border-color: #99c8ff;
  background: #eff6ff;
  color: #175cd3;
}

.platform-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.platform-body {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.platform-info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.platform-info-item,
.callback-line,
.platform-status-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-muted);
}

.platform-info-item {
  display: grid;
  gap: 6px;
  min-height: 82px;
  padding: 13px 14px;
}

.platform-info-item.primary {
  background: #f8fbff;
}

.platform-info-item span,
.callback-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.platform-info-item strong,
.platform-info-item a,
.callback-line strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.callback-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 15px 16px;
  background: #101828;
  border-color: #101828;
}

.callback-line > div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.callback-line span {
  color: #98a2b3;
}

.callback-line strong {
  color: #fff;
}

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

.platform-form .wide {
  grid-column: span 2;
}

.platform-settings-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.platform-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.platform-section-head h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.platform-section-head p {
  margin-top: 5px;
  font-size: 13px;
}

.platform-security-note {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 9px;
  background: #f2f4f7;
  color: #475467;
  font-size: 12px;
  font-weight: 750;
}

.platform-settings-card .platform-form {
  padding: 16px;
}

.recognition-settings-form {
  display: grid;
  gap: 14px;
}

.reminder-settings-page {
  display: grid;
  gap: 16px;
}

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

.reminder-policy {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.reminder-policy > header,
.reminder-policy > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
}

.reminder-policy > header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
}

.reminder-policy > header h3,
.reminder-policy > header p {
  margin: 0;
}

.reminder-policy > header h3 {
  font-size: 16px;
  letter-spacing: 0;
}

.reminder-policy > header p {
  max-width: 440px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.reminder-count {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: #ecfdf3;
  color: #027a48;
  font-size: 12px;
  font-weight: 750;
}

.reminder-schedule-list {
  display: grid;
}

.reminder-schedule-row {
  display: grid;
  grid-template-columns: 30px minmax(180px, 1fr) 90px 38px;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 14px;
  border-bottom: 1px solid #eaecf0;
}

.reminder-stage-index {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f2f4f7;
  color: #475467;
  font-size: 12px;
  font-weight: 750;
}

.reminder-schedule-row label {
  display: grid;
  grid-template-columns: minmax(80px, 140px) auto;
  align-items: center;
  gap: 8px;
  color: #475467;
  font-size: 13px;
}

.reminder-schedule-row input {
  min-width: 0;
}

.reminder-schedule-row strong {
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.reminder-policy > footer {
  justify-content: flex-start;
  background: #f8fafc;
}

.reminder-policy > footer button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.reminder-date-policy {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.reminder-date-policy-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: #eff8ff;
  color: #175cd3;
}

.reminder-date-policy > div:nth-child(2) {
  display: grid;
  gap: 3px;
}

.reminder-date-policy strong {
  font-size: 13px;
}

.reminder-date-policy span {
  color: var(--muted);
  font-size: 12px;
}

.reminder-settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.reminder-settings-actions > div {
  display: flex;
  align-items: center;
  gap: 14px;
}

.reminder-recalculate {
  width: min(360px, 100%);
}

.recognition-status-grid {
  align-items: stretch;
}

.recognition-status-grid .platform-status-box {
  min-height: 82px;
}

.check-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-muted);
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.check-field input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.service-managed-note {
  padding: 11px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.kdocs-browser {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}

.kdocs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.kdocs-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.kdocs-title-line h2,
.kdocs-content-head h3 {
  margin: 0;
  letter-spacing: 0;
}

.kdocs-title-line h2 {
  font-size: 18px;
}

.kdocs-header p {
  margin-top: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.kdocs-live-badge {
  border: 1px solid #fecdca;
  border-radius: 999px;
  padding: 3px 8px;
  background: #fef3f2;
  color: var(--danger);
  font-size: 12px;
  font-weight: 750;
}

.kdocs-live-badge.ready {
  border-color: #abefc6;
  background: #ecfdf3;
  color: var(--ok);
}

.kdocs-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.kdocs-tab {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: #475467;
}

.kdocs-tab:last-child {
  border-right: 0;
}

.kdocs-tab:hover,
.kdocs-tab.active {
  background: #f0fdfa;
  color: var(--accent-dark);
}

.kdocs-tab.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: var(--accent);
}

.kdocs-tab strong {
  min-width: 24px;
  border-radius: 999px;
  padding: 2px 6px;
  background: #f2f4f7;
  color: #475467;
  font-size: 11px;
}

.kdocs-tab i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
}

.kdocs-tab i.ready {
  background: var(--ok);
}

.kdocs-content {
  min-width: 0;
}

.kdocs-content-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 68px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}

.kdocs-content-head h3 {
  font-size: 15px;
}

.kdocs-content-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.kdocs-table-wrap {
  max-height: calc(100vh - 330px);
  overflow: auto;
}

.kdocs-table-filter {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(140px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.kdocs-table-filter label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.kdocs-table-filter label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kdocs-filter-actions {
  display: flex;
  gap: 8px;
}

.kdocs-table {
  min-width: 1280px;
}

.kdocs-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.kdocs-table th,
.kdocs-table td {
  max-width: 260px;
}

.kdocs-row-number {
  width: 54px;
  min-width: 54px;
  color: var(--muted);
  text-align: center;
}

.kdocs-row-actions {
  position: sticky;
  right: 0;
  width: 132px;
  min-width: 132px;
  background: #fff;
  box-shadow: -1px 0 0 var(--line);
  white-space: nowrap;
}

.kdocs-table thead .kdocs-row-actions {
  z-index: 3;
  background: #f8fafc;
}

.kdocs-row-actions button + button {
  margin-left: 6px;
}

.kdocs-row-dialog {
  width: min(920px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 64px rgb(16 24 40 / 28%);
}

.kdocs-row-dialog::backdrop {
  background: rgb(16 24 40 / 55%);
}

.kdocs-row-dialog-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: calc(100vh - 48px);
  background: #fff;
}

.kdocs-row-dialog-shell > header,
.kdocs-row-dialog-shell > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
}

.kdocs-row-dialog-shell > header {
  border-bottom: 1px solid var(--line);
}

.kdocs-row-dialog-shell > header h3,
.kdocs-row-dialog-shell > header p {
  margin: 0;
}

.kdocs-row-dialog-shell > header h3 {
  font-size: 17px;
}

.kdocs-row-dialog-shell > header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.kdocs-dialog-close {
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.kdocs-row-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  overflow: auto;
  padding: 18px 20px;
}

.kdocs-row-fields label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.kdocs-row-fields label > span {
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.kdocs-row-fields textarea {
  min-height: 64px;
  resize: vertical;
}

.kdocs-row-dialog-shell > footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.kdocs-cell-text {
  display: block;
  max-height: 60px;
  overflow: hidden;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.kdocs-identity-cell {
  max-height: none;
  overflow: visible;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.kdocs-link {
  color: #175cd3;
  font-weight: 700;
  text-decoration: none;
}

.kdocs-link:hover {
  text-decoration: underline;
}

.kdocs-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.kdocs-page-size,
.kdocs-page-jump {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.kdocs-page-size {
  margin-right: auto;
}

.kdocs-page-size select {
  width: 70px;
  padding: 8px;
}

.kdocs-page-jump input {
  width: 72px;
  padding: 8px;
}

.attribution-page-summary {
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
}

.kdocs-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.record-view-switch {
  display: inline-flex;
  gap: 2px;
  margin-bottom: 14px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f6f4;
}

.record-view-switch button {
  min-height: 34px;
  padding: 6px 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.record-view-switch button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgb(16 24 40 / 10%);
}

.reviewed-record-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #fff;
}

.reviewed-record-filter,
.reviewed-record-exports {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reviewed-record-filter label {
  color: var(--muted);
  font-size: 13px;
}

.reviewed-record-filter select {
  width: 140px;
}

.reviewed-enforcement-table {
  min-width: 1420px;
}

.reviewed-file-cell {
  display: grid;
  width: 240px;
  gap: 4px;
}

.reviewed-file-cell strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reviewed-file-cell small {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.kdocs-search-form {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 8px;
}

.kdocs-file-list {
  display: grid;
}

.kdocs-file-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) minmax(180px, 260px) auto;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.kdocs-file-row:last-child {
  border-bottom: 0;
}

.kdocs-file-row:hover {
  background: #f8fafc;
}

.kdocs-file-type {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #b2ddff;
  border-radius: 6px;
  background: #eff8ff;
  color: #175cd3;
  font-size: 10px;
  font-weight: 800;
}

.kdocs-file-main,
.kdocs-file-meta {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.kdocs-file-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.kdocs-file-main span,
.kdocs-file-meta span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-form-actions {
  grid-column: span 2;
}

.platform-status-box {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
}

.platform-status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--danger);
}

.platform-status-dot.online {
  background: var(--ok);
}

.platform-status-dot.warning {
  background: var(--warning);
}

.platform-status-dot.error {
  background: var(--danger);
}

.platform-status-box.success {
  border-color: #abefc6;
  background: #f6fef9;
}

.platform-status-box.warn {
  border-color: #fedf89;
  background: #fffaeb;
}

.platform-status-box p {
  margin-top: 4px;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.sender-qr-section {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 380px;
  align-items: center;
  gap: 48px;
  min-height: 430px;
  padding: 42px 48px;
}

.sender-step-label {
  color: #2f80ed;
  font-size: 12px;
  font-weight: 800;
}

.sender-qr-copy h3 {
  margin: 10px 0 0;
  font-size: 23px;
  letter-spacing: 0;
}

.sender-qr-copy p {
  max-width: 360px;
  margin-top: 12px;
  line-height: 1.7;
}

.sender-qr-copy button {
  margin-top: 24px;
}

.sender-qr-frame {
  display: grid;
  place-items: center;
  width: 340px;
  height: 340px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
}

.sender-qr-crop {
  position: relative;
  width: 300px;
  height: 300px;
  overflow: hidden;
  background: #f2f4f7;
}

.sender-qr-crop img {
  display: block;
  max-width: none;
  user-select: none;
}

.device-live-status {
  display: block;
  max-width: 300px;
  margin-top: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.sender-native-login {
  max-width: 430px;
  min-height: 360px;
  padding: 58px 48px;
}

.sender-native-login h3,
.sender-login-empty h3,
.sender-login-complete h3,
.sender-login-verification h3 {
  margin: 10px 0 0;
  font-size: 23px;
  letter-spacing: 0;
}

.sender-login-form {
  display: grid;
  gap: 12px;
  margin-top: 30px;
}

.sender-login-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.sender-login-form input {
  height: 46px;
}

.sender-login-form button {
  width: 100%;
  height: 46px;
  margin-top: 4px;
}

.sender-login-empty,
.sender-login-complete,
.sender-login-verification {
  display: grid;
  justify-items: center;
  min-height: 360px;
  padding: 64px 32px;
  text-align: center;
}

.sender-login-empty button {
  margin-top: 28px;
}

.sender-login-check {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #ecfdf3;
  color: var(--ok);
  font-size: 28px;
  font-weight: 800;
}

.sender-login-complete p {
  margin-top: 10px;
}

.sender-login-verification p {
  max-width: 520px;
  margin-top: 12px;
  line-height: 1.7;
}

.sender-login-verification > button {
  margin-top: 24px;
}

.sender-login-verification .button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 24px;
  padding: 0 16px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.sender-login-complete > button {
  margin-top: 22px;
}

.sender-identity-form {
  width: min(100%, 420px);
  text-align: left;
}

.sender-secret-input {
  position: relative;
}

.sender-secret-input input {
  width: 100%;
  padding-right: 66px;
}

.sender-login-form .sender-secret-input button {
  position: absolute;
  top: 0;
  right: 0;
  width: 58px;
  height: 46px;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.sender-login-form .sender-secret-input button:hover {
  background: var(--panel-muted);
}

.sender-verification-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fff4e5;
  color: var(--warning);
  font-size: 28px;
  font-weight: 800;
}

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

.form-grid .wide {
  grid-column: span 3;
}

.form-grid .wide-command {
  grid-column: span 1;
}

.field-command {
  display: flex;
  align-items: flex-end;
}

.form-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.case-group-cell {
  display: grid;
  gap: 3px;
  min-width: 180px;
}

.case-group-cell strong {
  font-size: 13px;
}

.archive-group-grid {
  margin-top: 14px;
}

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

.panel-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.platform-groups-empty {
  padding: 18px 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.integration-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.integration-note-title {
  margin-bottom: 5px;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}

.integration-note-body {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.integration-note-body .mono {
  white-space: normal;
  overflow-wrap: anywhere;
}

.callback-url-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.callback-url-block span {
  grid-column: 1 / -1;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.callback-url-block input {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  font-size: 12px;
}

.compact-input {
  min-width: 132px;
  padding: 7px 8px;
  font-size: 13px;
}

.compact-stack {
  margin-top: 6px;
}

.compact-number {
  width: 82px;
  min-width: 82px;
}

.compact-template {
  min-width: 280px;
  min-height: 68px;
  padding: 7px 8px;
  font-size: 13px;
}

.feature-checks {
  display: grid;
  gap: 5px;
  min-width: 108px;
}

.feature-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.feature-checks input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.archive-mapping-table {
  min-width: 1560px;
  table-layout: fixed;
}

.archive-mapping-table th,
.archive-mapping-table td {
  padding: 10px 8px;
}

.archive-mapping-table th:nth-child(1) { width: 220px; }
.archive-mapping-table th:nth-child(2) { width: 165px; }
.archive-mapping-table th:nth-child(3) { width: 145px; }
.archive-mapping-table th:nth-child(4) { width: 125px; }
.archive-mapping-table th:nth-child(5),
.archive-mapping-table th:nth-child(6) { width: 105px; }
.archive-mapping-table th:nth-child(7) { width: 140px; }
.archive-mapping-table th:nth-child(8) { width: 72px; }
.archive-mapping-table th:nth-child(9) { width: 105px; }
.archive-mapping-table th:nth-child(10) { width: 64px; }
.archive-mapping-table th:nth-child(11) { width: 130px; }
.archive-mapping-table th:nth-child(12) { width: 118px; }

.archive-mapping-table .compact-input {
  width: 100%;
  min-width: 0;
}

.archive-mapping-table .compact-number {
  width: 100%;
  min-width: 0;
}

.room-id-cell {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mapping-row-actions {
  display: grid;
  gap: 6px;
}

.mapping-row-actions button {
  width: 100%;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  gap: 6px;
}

button.small {
  padding: 7px 10px;
  font-size: 13px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  background: var(--panel-muted);
  color: #475467;
  font-weight: 700;
}

tr:hover td {
  background: #fbfcfe;
}

.table-wrap {
  overflow-x: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #3538cd;
  font-size: 12px;
  font-weight: 700;
}

.badge.ok {
  background: #ecfdf3;
  color: var(--ok);
}

.badge.warn {
  background: #fffaeb;
  color: var(--warning);
}

.badge.danger {
  background: #fef3f2;
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.empty-state {
  padding: 36px;
  color: var(--muted);
  text-align: center;
}

.json-cell {
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.review-toolbar select {
  width: 160px;
}

.sync-filter-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 0 0 16px;
}

.payment-tracking-filter {
  display: grid;
  grid-template-columns: 170px minmax(260px, 1fr) 130px auto auto;
  gap: 10px;
  align-items: end;
  padding-bottom: 16px;
}

.payment-tracking-view {
  display: grid;
  gap: 14px;
}

.payment-summary-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.payment-daily-summary {
  max-height: 320px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-muted);
  color: var(--text);
  font: 13px/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.payment-tracking-filter label > span {
  display: block;
  margin-bottom: 6px;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.payment-tracking-table {
  min-width: 1500px;
}

.payment-tracking-table th:nth-child(5),
.payment-tracking-table td:nth-child(5) {
  min-width: 155px;
}

.payment-amount-detail {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
}

.payment-receipt-assignment {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto;
  gap: 6px;
  min-width: 250px;
}

.payment-receipt-assignment select {
  min-width: 0;
  padding: 7px 9px;
}

.sync-filter-bar label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.sync-filter-bar label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sync-filter-bar select,
.sync-filter-bar button {
  min-height: 40px;
}

.review-workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: calc(100vh - 156px);
  min-height: 560px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.review-list-pane {
  min-height: 0;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--panel-muted);
}

.review-list-item {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  white-space: normal;
}

.review-list-item:hover,
.review-list-item.active {
  background: #e7f6f4;
  color: var(--accent-dark);
}

.review-list-item small {
  color: var(--muted);
}

.automation-badge {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid #f3c98b;
  border-radius: 4px;
  background: #fff7e8;
  color: #8a4b08;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
}

.automation-badge.auto {
  border-color: #a9d9cf;
  background: #eaf7f4;
  color: #096b5f;
}

.automation-badge.rejected {
  border-color: #d8dee8;
  background: #f2f4f7;
  color: #667085;
}

.review-detail-pane {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

@media (min-width: 821px) {
  body[data-view="ocr-reviews"],
  body[data-view="court-summons"],
  body[data-view="repayment-ledger"],
  body[data-view="repayment-materials"] {
    overflow: hidden;
  }

  body[data-view="ocr-reviews"] .main,
  body[data-view="court-summons"] .main,
  body[data-view="repayment-ledger"] .main,
  body[data-view="repayment-materials"] .main {
    display: flex;
    height: 100vh;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 24px;
  }

  body[data-view="ocr-reviews"] #content,
  body[data-view="court-summons"] #content,
  body[data-view="repayment-ledger"] #content,
  body[data-view="repayment-materials"] #content {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
  }

  body[data-view="ocr-reviews"] .review-workspace,
  body[data-view="court-summons"] .review-workspace,
  body[data-view="repayment-ledger"] .review-workspace,
  body[data-view="repayment-materials"] .review-workspace {
    height: auto;
    min-height: 0;
    flex: 1;
  }
}

.summons-callout {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: #eef8f6;
  color: var(--text);
  font-size: 13px;
}

.summons-heading {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.summons-heading strong,
.summons-heading .mono {
  overflow-wrap: anywhere;
}

.required {
  color: var(--danger);
  font-size: 12px;
}

.summons-sync-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.summons-sync-summary > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  background: var(--panel);
}

.summons-sync-summary span {
  color: var(--muted);
  font-size: 12px;
}

.summons-sync-summary strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.repayment-plan-list {
  display: grid;
  gap: 1px;
  margin: 10px 0 18px;
  border: 1px solid var(--line);
  background: var(--line);
}

.repayment-plan-list > div {
  display: grid;
  grid-template-columns: 90px minmax(120px, 1fr) minmax(180px, 1.5fr);
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  background: var(--panel);
}

.repayment-progress-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 1px;
  margin-top: 10px;
  border: 1px solid var(--line);
  background: var(--line);
}

.repayment-progress-summary > div {
  display: grid;
  gap: 5px;
  padding: 12px;
  background: var(--panel);
}

.repayment-progress-summary span {
  color: var(--muted);
  font-size: 12px;
}

.review-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.review-header-actions,
.context-heading,
.context-message header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.review-detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, 42%) minmax(0, 1fr);
  min-height: 100%;
}

.review-preview {
  min-width: 0;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: #eef1f4;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  height: 36px;
  padding: 0 2px 8px;
}

.preview-toolbar.hidden {
  visibility: hidden;
}

.preview-tool-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid #cbd5df;
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font-size: 19px;
  line-height: 1;
}

.preview-tool-button:hover {
  border-color: var(--accent);
  background: #e7f6f4;
  color: var(--accent-dark);
}

.preview-toolbar span {
  min-width: 32px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.preview-placeholder {
  width: 100%;
  height: calc(100vh - 271px);
  min-height: 420px;
  overflow: hidden;
  border: 0;
  background: #fff;
}

.review-preview img,
.review-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  object-fit: contain;
  transform-origin: center;
  transition: transform 160ms ease;
}

.preview-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.review-context-block,
.ocr-text-block {
  margin: 16px 0 0;
}

.context-heading {
  align-items: flex-start;
  margin-bottom: 9px;
}

.context-heading > div > span,
.context-message time,
.field-source {
  color: var(--muted);
  font-size: 12px;
}

.context-used {
  padding: 3px 7px;
  border: 1px solid #9acdc7;
  border-radius: 4px;
  background: #e7f6f4;
  color: var(--accent-dark);
  font-size: 12px;
}

.context-available {
  padding: 3px 7px;
  border: 1px solid #d7be80;
  border-radius: 4px;
  background: #fff8e8;
  color: #755c21;
  font-size: 12px;
}

.context-timeline {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-left: 12px;
  border-left: 2px solid #c8d3d8;
}

.context-message {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fa;
}

.context-message.after {
  border-color: #b8d8d3;
  background: #f1faf8;
}

.context-message p {
  margin: 6px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.context-empty {
  padding: 12px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.payment-tracking-table {
  min-width: 1180px;
}

.payment-tracking-table th:nth-child(5),
.payment-tracking-table td:nth-child(5),
.payment-tracking-table th:nth-child(7),
.payment-tracking-table td:nth-child(7) {
  min-width: 150px;
}

.text-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}

.field-source {
  margin-left: 5px;
  font-weight: 400;
}

.review-fields {
  min-width: 0;
  padding: 18px;
}

.automation-decision {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #f3c98b;
  border-left: 4px solid #d97706;
  border-radius: 6px;
  background: #fffaf0;
}

.automation-decision.auto {
  border-color: #a9d9cf;
  border-left-color: #0f8c82;
  background: #f0faf8;
}

.automation-decision.rejected {
  border-color: #d8dee8;
  border-left-color: #98a2b3;
  background: #f8fafc;
}

.automation-decision-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.automation-decision-head span,
.automation-decision-meta {
  color: var(--muted);
  font-size: 12px;
}

.automation-decision-meta {
  margin-top: 4px;
}

.automation-decision ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #7a3e05;
  font-size: 13px;
}

.automation-decision p {
  margin-top: 8px;
  color: #25675f;
  font-size: 13px;
}

.payment-review-actions,
.merchant-question-actions {
  display: flex;
  min-width: 150px;
  flex-wrap: wrap;
  gap: 6px;
}

.payment-confirmation-text {
  min-width: 240px;
  max-width: 440px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.payment-text-assignment {
  min-width: 360px;
}

.payment-text-assignment select {
  min-width: 260px;
}

.payment-unmatched-text-table td {
  vertical-align: top;
}

.merchant-question-content {
  min-width: 220px;
  max-width: 440px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.merchant-question-table td {
  vertical-align: top;
}

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

.review-form-grid .wide {
  grid-column: span 2;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.repayment-lifecycle {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 14px 18px 0;
  border: 1px solid var(--line);
  background: var(--line);
}

.repayment-stage {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #fff;
}

.repayment-stage > span {
  display: grid;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.repayment-stage.active > span {
  border-color: #128275;
  background: #128275;
  color: #fff;
}

.repayment-stage.done > span {
  border-color: var(--ok);
  background: var(--ok);
  color: #fff;
}

.repayment-stage.current > span {
  border-color: var(--accent);
  background: #fff;
  color: var(--accent-dark);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.repayment-stage.error > span {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.repayment-stage div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.repayment-stage strong,
.repayment-stage small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repayment-stage strong {
  font-size: 13px;
}

.repayment-stage small {
  color: var(--muted);
  font-size: 11px;
}

.repayment-ledger-title {
  margin-top: 18px;
}

.repayment-ledger-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.repayment-ledger-grid > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.repayment-ledger-grid span {
  color: var(--muted);
  font-size: 11px;
}

.repayment-ledger-grid strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.repayment-topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.repayment-ledger-filter {
  display: grid;
  grid-template-columns: 170px minmax(220px, 320px) auto auto;
  gap: 8px;
}

.repayment-ledger-filter input,
.repayment-ledger-filter select,
.repayment-ledger-filter button {
  min-height: 42px;
}

#media-filter-form {
  width: 100%;
  grid-template-columns: minmax(260px, 1fr) repeat(3, minmax(130px, 170px)) auto auto;
}

.media-file-name,
.media-inventory-table td > div:not(.table-actions) {
  display: grid;
  gap: 3px;
}

.media-file-name strong {
  max-width: 320px;
  overflow-wrap: anywhere;
}

.media-file-name small,
.media-inventory-table td small {
  color: var(--muted);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.table-actions button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.table-actions svg {
  width: 15px;
  height: 15px;
}

.repayment-inbox-filter {
  margin: 0;
  padding: 0;
}

.repayment-inbox-filter label:not(:first-child) {
  margin-left: 6px;
}

.repayment-stats-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: 12px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: #fff;
}

.repayment-stats-strip > div,
.repayment-stats-strip > button {
  display: grid;
  min-width: 0;
  min-height: 64px;
  align-content: center;
  gap: 4px;
  padding: 9px 12px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.repayment-stats-strip > button:hover,
.repayment-stats-strip > button.active {
  background: #eef8f6;
}

.repayment-stats-strip > button.danger strong {
  color: var(--danger);
}

.repayment-stats-strip span {
  color: var(--muted);
  font-size: 11px;
}

.repayment-stats-strip strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.repayment-effect-preview {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: #eef8f6;
}

.repayment-effect-preview.warning {
  border-left-color: var(--warning);
  background: #fff8eb;
}

.repayment-effect-preview > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.repayment-effect-preview > strong {
  font-size: 14px;
}

.repayment-effect-preview ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  color: #344054;
  font-size: 12px;
  line-height: 1.45;
}

.repayment-selection-empty {
  display: grid;
  min-height: 360px;
  place-content: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.repayment-selection-empty strong {
  color: #344054;
  font-size: 14px;
}

.repayment-selection-empty span {
  font-size: 12px;
}

.review-list-item em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.review-list-item em.danger {
  color: var(--danger);
}

.repayment-plan-editor {
  display: grid;
  gap: 7px;
  margin: 10px 0 8px;
}

.repayment-plan-total {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #f7f9fa;
}

.repayment-plan-total span,
.repayment-plan-total small {
  color: var(--muted);
  font-size: 12px;
}

.repayment-plan-total strong {
  margin-left: auto;
  font-size: 14px;
}

.repayment-plan-total small.ok {
  color: var(--ok);
}

.repayment-plan-total small.error {
  color: var(--danger);
}

.repayment-plan-row {
  display: grid;
  grid-template-columns: 86px minmax(150px, 1fr) minmax(140px, 1fr) 34px;
  gap: 8px;
  align-items: end;
  padding: 9px;
  border: 1px solid var(--line);
  background: var(--panel-muted);
}

.repayment-plan-row label {
  display: grid;
  gap: 4px;
}

.repayment-plan-row label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.repayment-plan-row input {
  min-height: 36px;
  padding: 7px 8px;
}

.plan-remove-button {
  display: grid;
  width: 34px;
  height: 36px;
  min-height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid #f1b4ae;
  border-radius: 5px;
  background: #fff;
  color: var(--danger);
  font-size: 20px;
}

.plan-remove-button:hover {
  background: #fef3f2;
  color: #912018;
}

.repayment-ledger-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.repayment-ledger-meta > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.repayment-ledger-meta span,
.repayment-ledger-meta small {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.repayment-ledger-meta strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.repayment-ledger-body {
  min-width: 0;
  padding: 16px 18px 24px;
}

.repayment-action-strip {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(0, 2fr);
  gap: 18px;
  align-items: center;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: #eef8f6;
}

.repayment-action-strip > div {
  display: grid;
  gap: 3px;
}

.repayment-action-strip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.repayment-action-strip strong {
  font-size: 14px;
}

.repayment-action-strip p {
  margin: 0;
  color: #344054;
  font-size: 13px;
  line-height: 1.55;
}

.repayment-action-strip.danger {
  border-left-color: var(--danger);
  background: #fef3f2;
}

.repayment-action-strip.complete {
  border-left-color: var(--ok);
  background: #f0f8f3;
}

.repayment-reminder-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.repayment-reminder-panel.complete {
  border-color: #abefc6;
  background: #f6fef9;
}

.repayment-reminder-head {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.repayment-reminder-panel.complete .repayment-reminder-head {
  border-bottom: 0;
}

.repayment-reminder-head > div,
.repayment-reminder-destination,
.repayment-reminder-target,
.repayment-reminder-copy,
.repayment-reminder-plan {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.repayment-reminder-head span,
.repayment-reminder-head small,
.repayment-reminder-grid span,
.repayment-reminder-grid small,
.repayment-reminder-copy > span,
.repayment-reminder-plan > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.repayment-reminder-head strong {
  font-size: 15px;
}

.repayment-reminder-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.35fr);
  border-bottom: 1px solid var(--line);
}

.repayment-reminder-grid > * {
  padding: 12px 14px;
}

.repayment-reminder-grid > * + * {
  border-left: 1px solid var(--line);
}

.repayment-reminder-target select {
  min-height: 38px;
  margin-top: 3px;
}

.repayment-reminder-copy,
.repayment-reminder-plan {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.repayment-reminder-copy p {
  margin: 3px 0 0;
  color: #344054;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.repayment-reminder-schedule {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 16px;
  margin-top: 4px;
}

.repayment-reminder-schedule > div {
  display: flex;
  min-width: 0;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #eaecf0;
}

.repayment-reminder-schedule strong,
.repayment-reminder-schedule span,
.repayment-reminder-empty {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.repayment-reminder-schedule span,
.repayment-reminder-empty {
  color: var(--muted);
}

.repayment-reminder-confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--warning);
  background: #fffaeb;
}

.repayment-reminder-confirm[hidden] {
  display: none;
}

.repayment-reminder-confirm p {
  flex: 1;
  margin: 0;
  color: #475467;
  font-size: 12px;
}

.repayment-reminder-confirm > div {
  display: flex;
  gap: 8px;
}

.repayment-payment-timeline {
  display: grid;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}

.repayment-payment-timeline > div:not(.empty-state) {
  display: grid;
  grid-template-columns: 110px 100px minmax(150px, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
}

.repayment-payment-timeline span,
.repayment-payment-timeline small {
  color: var(--muted);
  font-size: 12px;
}

.repayment-plan-list .installment-overdue {
  border-left: 3px solid var(--danger);
}

.repayment-plan-list .installment-paid {
  border-left: 3px solid var(--ok);
}

.sync-error-block {
  display: grid;
  gap: 5px;
  margin-top: 16px;
  padding: 12px;
  border-left: 3px solid var(--danger);
  background: #fef3f2;
  color: #912018;
  font-size: 13px;
}

.detail-loading {
  display: grid;
  min-height: 320px;
  place-items: center;
  color: var(--muted);
}

.review-audit {
  margin-top: 14px;
  line-height: 1.7;
}

.ocr-text-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.field-label {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.ocr-text-block pre {
  max-height: 250px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #344054;
  font-size: 12px;
  line-height: 1.6;
}

.case-workspace-view,
.attribution-view {
  display: grid;
  gap: 16px;
}

.attribution-workspace {
  display: grid;
  grid-template-columns: minmax(330px, 38%) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  min-height: 620px;
}

.attribution-tools, .import-summary, .import-actions { display: flex; align-items: center; gap: 12px; }
.attribution-tools { justify-content: flex-end; }
.import-summary { margin: 16px 0 10px; padding: 10px 12px; background: var(--panel-muted); border: 1px solid var(--line); font-size: 12px; }
.import-actions { justify-content: flex-end; margin-top: 12px; }

.attribution-queue-panel,
.attribution-detail-panel {
  border: 1px solid var(--line);
  background: var(--panel);
}

.attribution-queue-panel { position: sticky; top: 12px; }
.attribution-queue-heading { display: flex; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.attribution-queue-heading span { color: var(--muted); font-size: 12px; }
.attribution-queue-list { height: min(62vh, 680px); overflow-y: auto; }
.attribution-queue-item { width: 100%; min-height: 86px; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: inherit; text-align: left; }
.attribution-queue-item:hover, .attribution-queue-item.active { background: #f4f7f5; }
.attribution-queue-item.active { box-shadow: inset 3px 0 0 var(--accent); }
.attribution-item-main { min-width: 0; display: grid; gap: 4px; }
.attribution-item-main strong, .attribution-item-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attribution-item-main small { color: var(--muted); }
.attribution-item-amount { font-weight: 700; color: #17663a; }
.attribution-detail-panel { position: sticky; top: 12px; max-height: calc(100vh - 40px); overflow-y: auto; padding: 18px; }
.attribution-detail-header { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.attribution-detail-header h3 { margin: 4px 0; font-size: 16px; }
.attribution-detail-header p { margin: 0; color: var(--muted); font-size: 12px; }
.attribution-detail-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(280px, 1fr); gap: 18px; margin-top: 18px; }
.attribution-preview { height: 320px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); background: #f7f8f7; color: var(--muted); }
.attribution-preview img, .attribution-preview iframe { width: 100%; height: 100%; object-fit: contain; border: 0; }
.attribution-fields { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); }
.attribution-fields > div { min-height: 72px; display: grid; align-content: center; gap: 3px; padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.attribution-fields > div:nth-child(2n) { border-right: 0; }
.attribution-fields span, .attribution-fields small { color: var(--muted); font-size: 11px; }
.attribution-text-section, .attribution-context-section, .attribution-side-effect { margin-top: 18px; }
.attribution-text-section pre { max-height: 180px; overflow: auto; margin: 7px 0 0; padding: 12px; background: #f7f8f7; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 12px; line-height: 1.6; }
.attribution-context-list { max-height: 250px; overflow-y: auto; border: 1px solid var(--line); }
.attribution-context-list article { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.attribution-context-list article:last-child { border-bottom: 0; }
.attribution-context-list span { color: var(--muted); font-size: 11px; }
.attribution-context-list p { margin: 4px 0 0; font-size: 12px; line-height: 1.5; }
.attribution-side-effect { padding: 12px 14px; border-left: 3px solid #31704c; background: #f4f7f5; }
.attribution-side-effect p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }

.case-workspace-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.case-workspace-header h2 {
  margin: 12px 0 6px;
  font-size: 24px;
  letter-spacing: 0;
}

.case-workspace-header p,
.case-workspace-amount span {
  color: var(--muted);
}

.case-workspace-amount {
  display: grid;
  justify-items: end;
  gap: 6px;
  white-space: nowrap;
}

.case-workspace-amount strong {
  font-size: 22px;
}

.workspace-stat-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(84px, 1fr));
  border: 1px solid var(--line);
  background: var(--panel);
}

.workspace-stat-grid > div {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}

.workspace-stat-grid > div:last-child { border-right: 0; }
.workspace-stat-grid span { color: var(--muted); font-size: 12px; }
.workspace-stat-grid strong { font-size: 20px; }

.workspace-columns {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(360px, 1fr);
  align-items: start;
  gap: 16px;
}

.workspace-main,
.workspace-side {
  display: grid;
  gap: 16px;
}

.workspace-side {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}

@media (max-width: 1100px) {
  .kdocs-table-filter { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .workspace-columns { grid-template-columns: minmax(0, 1fr); }
  .workspace-side { position: static; max-height: none; overflow: visible; }
  .workspace-stat-grid { grid-template-columns: repeat(4, minmax(80px, 1fr)); }
  .repayment-topbar { align-items: stretch; flex-direction: column; }
  .repayment-ledger-filter { grid-template-columns: 170px minmax(220px, 1fr) auto auto; }
  #media-filter-form { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .repayment-stats-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .repayment-ledger-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .repayment-reminder-confirm { align-items: stretch; flex-direction: column; }
}

@media (min-width: 821px) and (max-width: 1300px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .sidebar {
    padding-right: 12px;
    padding-left: 12px;
  }

  .main {
    padding-right: 20px;
    padding-left: 20px;
  }

  .review-workspace {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .review-detail-grid {
    grid-template-columns: minmax(300px, 38%) minmax(0, 1fr);
  }

  .repayment-plan-row {
    grid-template-columns: 70px minmax(125px, 1fr) minmax(110px, 1fr) 34px;
    gap: 6px;
    padding: 8px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    z-index: 10;
    width: 100%;
    height: auto;
    padding: 10px 12px;
    overflow: hidden;
  }

  .brand {
    display: none;
  }

  .nav {
    display: flex;
    gap: 4px;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .nav-item {
    width: auto;
    flex: 0 0 auto;
    padding: 9px 11px;
  }

  .main {
    padding: 16px 14px 28px;
    overflow-x: hidden;
  }

  .topbar {
    display: grid;
    gap: 14px;
  }

  .panel-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .panel-actions button {
    flex: 1 1 140px;
  }

  .sync-filter-bar {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .kdocs-table-filter {
    grid-template-columns: minmax(0, 1fr);
  }

  .kdocs-pagination {
    flex-wrap: wrap;
  }

  .section-tabs {
    margin-right: -14px;
    margin-left: -14px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .workbench-heading {
    align-items: flex-end;
  }

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

  .case-candidate-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .case-candidate-actions {
    justify-content: flex-start;
  }

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

  .reminder-policy-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid .wide {
    grid-column: span 2;
  }

  .candidate-form-actions {
    grid-column: span 2;
  }

  .workbench-task-card {
    min-height: 150px;
  }

  .workbench-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .workbench-queue-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .queue-detail {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .queue-time {
    display: none;
  }

  .key-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    width: 100%;
  }

  .key-panel input {
    width: 100%;
    min-width: 0;
  }

  .integration-note {
    grid-template-columns: minmax(0, 1fr);
  }

  .review-workspace {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .review-list-pane {
    max-height: 280px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .review-detail-pane {
    min-width: 0;
    overflow: visible;
  }

  .review-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .repayment-ledger-filter,
  .repayment-stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #media-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .repayment-plan-row {
    grid-template-columns: 80px minmax(130px, 1fr) minmax(120px, 1fr) 34px;
  }

  .repayment-payment-timeline > div:not(.empty-state) {
    grid-template-columns: 100px 90px minmax(120px, 1fr) auto;
  }

  .repayment-reminder-grid,
  .repayment-reminder-schedule {
    grid-template-columns: minmax(0, 1fr);
  }

  .repayment-reminder-grid > * + * {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .review-preview {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .preview-placeholder {
    height: 420px;
  }

  .platform-hero,
  .platform-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .platform-hero-actions {
    justify-content: stretch;
  }

  .platform-hero-actions > * {
    flex: 1 1 auto;
  }

  .platform-info-grid,
  .callback-line,
  .platform-form,
  .recognition-status-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .kdocs-tab:nth-child(2) {
    border-right: 0;
  }

  .kdocs-content-head,
  .kdocs-header {
    align-items: stretch;
    flex-direction: column;
  }

  .kdocs-search-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .kdocs-file-row {
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }

  .kdocs-file-meta {
    display: none;
  }

  .platform-form .wide,
  .platform-form-actions {
    grid-column: span 1;
  }

  .sender-account-login {
    width: 100%;
  }

  .sender-login-empty,
  .sender-login-complete,
  .sender-login-verification {
    min-height: 320px;
    padding: 42px 20px;
  }

  .sender-native-login {
    max-width: none;
    min-height: 320px;
    padding: 42px 20px;
  }

  .sender-qr-section {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    padding: 32px 20px;
  }

  .sender-qr-frame {
    width: min(100%, 340px);
    height: auto;
    aspect-ratio: 1;
    justify-self: center;
  }

  .sender-qr-crop {
    width: min(88%, 300px);
    height: auto;
    aspect-ratio: 1;
  }
}

@media (max-width: 480px) {
  .review-detail-header {
    align-items: stretch;
    flex-direction: column;
  }

  .review-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .workbench-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .workbench-task-card {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    min-height: 126px;
  }

  .workbench-task-card strong {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .workbench-task-note,
  .workbench-task-action {
    grid-column: 1;
  }

  .form-grid,
  .case-candidate-form.form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid .wide {
    grid-column: span 1;
  }

  .candidate-form-actions {
    grid-column: span 1;
  }

  .sync-filter-bar {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Operational console redesign */
:root {
  --bg: #f2f4f2;
  --panel: #ffffff;
  --panel-muted: #f7f8f7;
  --text: #202522;
  --muted: #68716c;
  --line: #d9dedb;
  --line-strong: #c5ccc8;
  --accent: #176b5b;
  --accent-dark: #105246;
  --accent-soft: #e6f1ed;
  --info: #356a9a;
  --danger: #a4342b;
  --danger-soft: #f9ecea;
  --warning: #955b16;
  --warning-soft: #fbf2e3;
  --ok: #31734f;
  --ok-soft: #e9f3ed;
  --nav: #242723;
  --nav-raised: #343934;
  --nav-muted: #aeb6b0;
  --shadow: none;
  --focus: 0 0 0 3px rgb(23 107 91 / 16%);
}

* {
  letter-spacing: 0;
}

html,
body {
  min-height: 100%;
}

body {
  background: var(--bg);
  font-family: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

svg.lucide {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  stroke-width: 1.8;
}

.app-shell {
  grid-template-columns: 216px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  overflow: hidden;
  border-right: 1px solid #181b18;
  background: var(--nav);
}

.brand {
  min-height: 60px;
  gap: 10px;
  padding: 4px 8px 16px;
  border-bottom-color: rgb(255 255 255 / 10%);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 5px;
  background: #e1ebe6;
  color: #1d4f42;
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-title {
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  font-size: 17px;
  font-weight: 700;
}

.brand-subtitle {
  color: var(--nav-muted);
  font-size: 11px;
}

.nav {
  gap: 3px;
  margin-top: 16px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 9px 11px;
  border-radius: 5px;
  color: #c8cec9;
  font-size: 14px;
  font-weight: 550;
}

.nav-item svg {
  color: #969f98;
}

.nav-item:hover {
  background: #2c302c;
  color: #fff;
}

.nav-item.active {
  background: var(--nav-raised);
  color: #fff;
  box-shadow: inset 3px 0 0 #83b9a8;
}

.nav-item.active svg {
  color: #b7dfd2;
}

.nav-item:focus-visible {
  outline: 2px solid #9acabb;
  outline-offset: 2px;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 14px 10px 4px;
  border-top: 1px solid rgb(255 255 255 / 10%);
  color: var(--nav-muted);
  font-size: 11px;
}

.sidebar-footer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #71b895;
  box-shadow: 0 0 0 3px rgb(113 184 149 / 13%);
}

.main {
  min-width: 0;
  padding: 0 24px 32px;
}

.topbar {
  min-height: 94px;
  align-items: center;
  margin: 0;
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.page-heading {
  min-width: 0;
}

.page-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 750;
}

h1 {
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  font-size: 24px;
  font-weight: 700;
}

.topbar p {
  margin-top: 4px;
  font-size: 13px;
}

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

button,
.button-like {
  min-height: 36px;
  border-radius: 5px;
  padding: 8px 12px;
  background: var(--accent);
  font-size: 13px;
  font-weight: 650;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;
}

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

button:focus-visible,
.button-like:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button.ghost,
.button-like.ghost {
  border-color: var(--line-strong);
  background: #fff;
}

button.ghost:hover,
.button-like.ghost:hover {
  border-color: #9aa59f;
  background: #f5f7f5;
}

button.danger-button {
  background: var(--danger);
}

button.small {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  min-width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
}

.icon-button.is-loading svg,
.loading-spinner svg {
  animation: spin 850ms linear infinite;
}

.security-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.security-key-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
}

.security-key-dot.configured {
  background: var(--ok);
}

input,
select,
textarea {
  min-height: 38px;
  border-color: var(--line-strong);
  border-radius: 4px;
  padding: 8px 10px;
  background: #fff;
  font-size: 13px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #f1f3f1;
  color: #58615c;
}

.section-tabs {
  min-height: 44px;
  gap: 18px;
  margin: 0 0 14px;
  padding: 0;
  overflow: visible;
}

.section-tab {
  position: relative;
  min-height: 43px;
  padding: 10px 1px 9px;
  border-radius: 0;
  color: var(--muted);
  font-size: 13px;
}

.section-tab:hover {
  background: transparent;
  color: var(--text);
}

.section-tab.active {
  background: transparent;
  color: var(--text);
  font-weight: 700;
}

.section-tab.active::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--accent);
  content: "";
}

#content {
  min-width: 0;
}

.alert {
  position: fixed;
  z-index: 80;
  top: 18px;
  right: 22px;
  width: min(440px, calc(100vw - 44px));
  margin: 0;
  border-radius: 5px;
  box-shadow: 0 12px 30px rgb(32 37 34 / 16%);
}

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 320px;
  color: var(--muted);
}

.page-loading > div {
  display: grid;
  gap: 2px;
}

.page-loading strong {
  color: var(--text);
  font-size: 13px;
}

.page-loading span {
  font-size: 12px;
}

.loading-spinner {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
}

.settings-dialog {
  width: min(520px, calc(100vw - 40px));
  border: 0;
  border-radius: 6px;
  padding: 0;
  color: var(--text);
  box-shadow: 0 24px 70px rgb(20 24 21 / 28%);
}

.settings-dialog::backdrop {
  background: rgb(24 28 25 / 48%);
}

.settings-dialog-shell {
  background: #fff;
}

.settings-dialog-shell > header,
.settings-dialog-shell > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.settings-dialog-shell > header {
  border-bottom: 1px solid var(--line);
}

.settings-dialog-shell > header h2 {
  margin: 0;
  font-size: 18px;
}

.settings-dialog-shell > footer {
  border-top: 1px solid var(--line);
  background: var(--panel-muted);
}

.settings-dialog-shell > footer > div {
  display: flex;
  gap: 8px;
}

.settings-dialog-body {
  display: grid;
  gap: 12px;
  padding: 20px 18px 24px;
}

.settings-dialog-body .field {
  display: grid;
  gap: 7px;
}

.settings-dialog-body .field > span {
  font-size: 12px;
  font-weight: 700;
}

.credential-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-left: 3px solid var(--warning);
  background: var(--warning-soft);
  color: #70440f;
  font-size: 12px;
}

.credential-status.configured {
  border-left-color: var(--ok);
  background: var(--ok-soft);
  color: #245b3d;
}

.panel,
.case-candidates,
.workbench-queue,
.workbench-connections,
.kdocs-browser,
.platform-console,
.sender-account-login {
  border-color: var(--line);
  border-radius: 5px;
  box-shadow: none;
}

.panel-header {
  min-height: 48px;
  padding: 12px 16px;
  background: #fff;
}

.panel-title {
  font-size: 14px;
  font-weight: 750;
}

.panel-body {
  padding: 16px;
}

.panel-body > .table-wrap:last-child,
.panel-body > .table-wrap + .kdocs-pagination {
  margin-right: -16px;
  margin-left: -16px;
}

.panel-body > .table-wrap:last-child {
  margin-bottom: -16px;
}

.table-wrap {
  border-top: 1px solid var(--line);
  scrollbar-color: #b8c0bb transparent;
  scrollbar-width: thin;
}

table {
  font-size: 12px;
}

th,
td {
  padding: 10px 11px;
  border-bottom-color: #e4e8e5;
}

th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #f4f6f4;
  color: #4f5953;
  font-size: 11px;
}

tr:hover td {
  background: #f7faf8;
}

.badge {
  min-height: 22px;
  border: 1px solid #cdd9e6;
  border-radius: 4px;
  padding: 2px 6px;
  background: #edf3f8;
  color: #315d84;
  font-size: 11px;
}

.badge.ok {
  border-color: #bfddca;
  background: var(--ok-soft);
}

.badge.warn {
  border-color: #e5c997;
  background: var(--warning-soft);
}

.badge.danger {
  border-color: #e3b8b4;
  background: var(--danger-soft);
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 28px;
}

.empty-state strong {
  color: var(--text);
  font-size: 13px;
}

.empty-state span {
  color: var(--muted);
  font-size: 12px;
}

.business-view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 2px 0 13px;
  border-bottom: 1px solid var(--line);
}

.business-view-header h2 {
  margin: 0;
  font-size: 16px;
}

.business-view-header p {
  margin-top: 3px;
  font-size: 12px;
}

.record-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.workflow-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.workflow-metrics.compact {
  grid-template-columns: repeat(3, minmax(130px, 1fr));
}

.workflow-metric {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}

.workflow-metric:last-child {
  border-right: 0;
}

.workflow-metric > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.workflow-metric > strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.workflow-metric.attention {
  box-shadow: inset 0 3px 0 #bd822e;
}

.workflow-metric.danger {
  box-shadow: inset 0 3px 0 var(--danger);
}

.workflow-metric.clear {
  box-shadow: inset 0 3px 0 #74a98a;
}

.workflow-metric.neutral {
  box-shadow: inset 0 3px 0 #6e8eaa;
}

.payment-tracking-view,
.merchant-view {
  display: grid;
  gap: 12px;
}

.payment-tracking-filter {
  position: sticky;
  z-index: 4;
  top: 0;
  grid-template-columns: 150px minmax(240px, 1fr) 110px auto auto;
  margin: -16px -16px 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.payment-tracking-table {
  width: 100%;
  min-width: 1180px;
  table-layout: fixed;
}

.payment-tracking-table th {
  white-space: nowrap;
}

.payment-tracking-table th:nth-child(1) { width: 220px; }
.payment-tracking-table th:nth-child(2) { width: 180px; }
.payment-tracking-table th:nth-child(3) { width: 205px; }
.payment-tracking-table th:nth-child(4) { width: 165px; }
.payment-tracking-table th:nth-child(5) { width: 230px; }
.payment-tracking-table th:nth-child(6) { width: 180px; }

.payment-tracking-table td {
  overflow-wrap: anywhere;
}

.payment-kind {
  display: block;
  width: max-content;
  margin-bottom: 6px;
  padding: 2px 6px;
  border-left: 3px solid var(--accent);
  background: #edf5f2;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
}

.payment-kind.pending {
  border-left-color: #b27a2d;
  background: #fff7e8;
  color: #815313;
}

.payment-tracking-table .payment-receipt-assignment {
  grid-template-columns: minmax(118px, 1fr) auto;
  min-width: 0;
}

.payment-tracking-table .payment-review-actions {
  display: grid;
  width: 100%;
  min-width: 0;
  align-items: stretch;
}

.payment-tracking-table .payment-review-actions button {
  width: 100%;
  white-space: normal;
}

.payment-decision-stack {
  margin-top: 7px;
}

.payment-document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 7px;
}

.payment-source-message {
  margin-top: 7px;
}

.payment-source-message summary {
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
}

.payment-source-message p {
  max-height: 120px;
  margin: 6px 0 0;
  overflow-y: auto;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.55;
}

.payment-tracking-summary {
  display: block;
  margin-top: 7px;
  font-size: 12px;
}

.payment-reminder-steps,
.payment-attachments {
  display: grid;
  gap: 6px;
  margin-top: 7px;
}

.payment-reminder-step {
  padding-left: 8px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.payment-reminder-step.sent { border-color: var(--success); }
.payment-reminder-step.failed { border-color: var(--danger); color: var(--danger); }

.payment-attachment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 6px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f8faf9;
}

.payment-attachment > span,
.payment-attachment > small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-attachment > small {
  grid-column: 1;
  color: var(--muted);
}

.payment-attachment > div {
  display: flex;
  grid-column: 2;
  grid-row: 1 / span 2;
  gap: 4px;
  align-items: center;
}

.payment-sync-error {
  display: block;
  margin: 6px 0;
  color: var(--danger);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.payment-summary-disclosure {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.payment-summary-disclosure > summary {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 15px;
  cursor: pointer;
  list-style: none;
}

.payment-summary-disclosure > summary::-webkit-details-marker {
  display: none;
}

.payment-summary-disclosure > summary > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.payment-summary-disclosure > summary > span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.payment-summary-content {
  padding: 14px 15px 15px;
  border-top: 1px solid var(--line);
}

.payment-daily-summary {
  max-height: 360px;
  border-radius: 4px;
  background: #f6f7f5;
  font-family: "Noto Sans Mono CJK SC", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.merchant-filter-bar {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.merchant-filter-bar .payment-tracking-filter {
  position: static;
  grid-template-columns: 190px 110px auto;
  justify-content: start;
  margin: 0;
  border-bottom: 0;
}

.merchant-task-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.merchant-task {
  border-bottom: 1px solid var(--line);
  box-shadow: inset 3px 0 0 transparent;
}

.merchant-task:last-child {
  border-bottom: 0;
}

.merchant-task.review {
  box-shadow: inset 3px 0 0 #bd822e;
}

.merchant-task.escalated {
  box-shadow: inset 3px 0 0 var(--danger);
}

.merchant-task-header,
.merchant-task-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
}

.merchant-task-header {
  background: #fafbfa;
}

.merchant-task-source {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.merchant-source-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--accent);
}

.merchant-task-source > div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.merchant-task-source strong,
.merchant-task-source span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merchant-task-source span {
  color: var(--muted);
  font-size: 10px;
}

.merchant-task-body {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(240px, 0.7fr);
  gap: 0;
  border-top: 1px solid #edf0ee;
  border-bottom: 1px solid #edf0ee;
}

.merchant-message,
.merchant-decision {
  min-width: 0;
  padding: 13px 14px;
}

.merchant-decision {
  border-left: 1px solid var(--line);
  background: #fafbfa;
}

.merchant-message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.merchant-message-meta strong {
  color: var(--text);
}

.merchant-message p {
  margin: 8px 0 0;
  color: #303733;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.merchant-decision-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.merchant-decision p {
  margin-top: 7px;
  font-size: 11px;
  line-height: 1.55;
}

.merchant-assignment {
  display: grid;
  grid-template-columns: auto minmax(90px, auto) auto minmax(120px, auto);
  gap: 5px 8px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}

.merchant-assignment strong {
  color: var(--text);
  font-size: 12px;
}

.merchant-question-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.workbench {
  gap: 12px;
}

.workbench-heading {
  padding: 2px 0 11px;
  border-bottom: 1px solid var(--line);
}

.workbench-heading h2,
.workbench-queue h2,
.workbench-connections h2 {
  font-size: 15px;
}

.workbench-summary {
  grid-template-columns: repeat(6, minmax(128px, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.workbench-task-card {
  position: relative;
  grid-template-rows: 24px auto auto 22px;
  min-height: 150px;
  padding: 13px;
  border: 0;
  border-right: 1px solid var(--line);
  border-top: 3px solid #94a09a;
  border-radius: 0;
  background: #fff;
}

.workbench-task-card:last-child {
  border-right: 0;
}

.workbench-task-card:hover {
  z-index: 1;
  background: #f7faf8;
  box-shadow: inset 0 0 0 1px #a9bbb3;
}

.workbench-task-icon {
  color: var(--muted);
}

.workbench-task-label {
  color: #414943;
  font-size: 12px;
}

.workbench-task-card strong {
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}

.workbench-task-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.workbench-task-action svg {
  width: 13px;
  height: 13px;
}

.workbench-layout {
  grid-template-columns: minmax(0, 1.8fr) minmax(270px, 0.7fr);
  gap: 12px;
}

.workbench-queue > header,
.workbench-connections > header {
  min-height: 52px;
  padding: 12px 14px;
}

.workbench-queue-row {
  grid-template-columns: 8px minmax(0, 1fr) 150px 28px;
  gap: 10px;
  min-height: 62px;
  padding: 9px 13px;
}

.queue-priority {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #bc8536;
}

.workbench-queue-row.critical .queue-priority {
  background: var(--danger);
}

.queue-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.queue-file,
.queue-detail {
  display: block;
}

.queue-time {
  text-align: right;
}

.queue-action {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 4px;
}

.workbench-queue-row:hover .queue-action {
  background: var(--accent-soft);
}

.workbench-connection {
  min-height: 58px;
  padding: 9px 14px;
}

.review-toolbar,
.repayment-topbar {
  min-height: 44px;
  margin: 0 0 10px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.review-toolbar select {
  width: 150px;
  min-height: 34px;
}

.review-workspace {
  grid-template-columns: 270px minmax(0, 1fr);
  height: auto;
  min-height: 520px;
  border-radius: 5px;
  box-shadow: none;
}

.review-list-pane {
  background: #f5f7f5;
}

.review-list-item {
  gap: 4px;
  min-height: 76px;
  padding: 11px 13px;
  border-left: 3px solid transparent;
  font-size: 12px;
}

.review-list-item:hover {
  background: #eef3f0;
  color: var(--text);
}

.review-list-item.active {
  border-left-color: var(--accent);
  background: #e6f0ec;
  color: var(--accent-dark);
}

.review-list-item > span {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-detail-header {
  min-height: 64px;
  padding: 12px 15px;
  background: #fff;
}

.review-detail-grid {
  grid-template-columns: minmax(330px, 43%) minmax(0, 1fr);
  min-height: 0;
}

.review-preview {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 10px;
  background: #e9edeb;
}

.preview-toolbar {
  height: 34px;
  padding: 0 0 7px;
}

.preview-tool-button {
  width: 30px;
  height: 28px;
  border-radius: 4px;
}

.preview-tool-button svg {
  width: 15px;
  height: 15px;
}

.preview-placeholder {
  min-height: 0;
  flex: 1;
  border: 1px solid #d4d9d6;
}

.review-fields {
  min-width: 0;
  padding: 14px 16px 20px;
  background: #fff;
}

.automation-decision {
  margin: 0 0 12px;
  border: 1px solid #e1c18c;
  border-left: 3px solid #bd7a1e;
  border-radius: 4px;
  padding: 10px 11px;
  background: #fcf6eb;
}

.automation-decision.auto {
  border-color: #b8d5c3;
  border-left-color: var(--ok);
  background: #edf5f0;
}

.automation-decision.rejected {
  border-color: var(--line);
  border-left-color: #8b948f;
  background: #f4f6f4;
}

.automation-decision-head strong {
  font-size: 13px;
}

.automation-decision-head span,
.automation-decision-meta,
.automation-decision li,
.automation-decision p {
  font-size: 11px;
}

.automation-badge {
  border-radius: 3px;
}

.summons-callout {
  margin-bottom: 12px;
  border-left-color: var(--accent);
  background: #edf5f2;
  font-size: 12px;
}

.review-form-grid {
  gap: 10px;
}

.review-actions {
  position: static;
  margin: 14px 0 0;
  padding: 11px 0 0;
  border-top: 1px solid var(--line);
  background: #fff;
}

.context-message {
  border-radius: 4px;
}

.context-timeline {
  max-height: 230px;
}

.repayment-lifecycle {
  border-bottom: 1px solid var(--line);
}

.repayment-stats-strip {
  margin-bottom: 10px;
  border-radius: 5px;
}

.repayment-ledger-workspace .review-detail-pane {
  overflow-y: auto;
}

.kdocs-pagination {
  min-height: 48px;
  border-color: var(--line);
  background: #fafbfa;
}

@media (min-width: 821px) {
  body[data-view="ocr-reviews"] .main,
  body[data-view="court-summons"] .main,
  body[data-view="repayment-ledger"] .main,
  body[data-view="repayment-materials"] .main {
    padding-bottom: 18px;
  }

  body[data-view="ocr-reviews"] .review-detail-pane,
  body[data-view="court-summons"] .review-detail-pane,
  body[data-view="repayment-materials"] .review-detail-pane {
    display: grid;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  body[data-view="repayment-materials"] .review-detail-pane {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  body[data-view="ocr-reviews"] .review-detail-grid,
  body[data-view="court-summons"] .review-detail-grid,
  body[data-view="repayment-materials"] .review-detail-grid {
    height: 100%;
    overflow: hidden;
  }

  body[data-view="ocr-reviews"] .review-fields,
  body[data-view="court-summons"] .review-fields,
  body[data-view="repayment-materials"] .review-fields {
    min-height: 0;
    overflow-y: auto;
  }
}

@media (max-width: 1360px) and (min-width: 921px) {
  .payment-tracking-table {
    min-width: 960px;
  }

  .payment-tracking-table th,
  .payment-tracking-table td {
    padding-right: 8px;
    padding-left: 8px;
  }

  .payment-tracking-table th:nth-child(1) { width: 175px; }
  .payment-tracking-table th:nth-child(2) { width: 145px; }
  .payment-tracking-table th:nth-child(3) { width: 170px; }
  .payment-tracking-table th:nth-child(4) { width: 130px; }
  .payment-tracking-table th:nth-child(5) { width: 190px; min-width: 0; }
  .payment-tracking-table th:nth-child(6) { width: 150px; }
  .payment-tracking-table td:nth-child(5) { min-width: 0; }

  .payment-tracking-table .payment-receipt-assignment {
    grid-template-columns: minmax(0, 1fr);
  }

  .payment-tracking-table .payment-receipt-assignment button {
    width: 100%;
  }
}

@media (max-width: 1260px) {
  .app-shell {
    grid-template-columns: 196px minmax(0, 1fr);
  }

  .main {
    padding-right: 18px;
    padding-left: 18px;
  }

  .workbench-summary {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .workbench-task-card:nth-child(3) {
    border-right: 0;
  }

  .workbench-task-card:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

  .review-workspace {
    grid-template-columns: 238px minmax(0, 1fr);
  }

  .review-detail-grid {
    grid-template-columns: minmax(300px, 39%) minmax(0, 1fr);
  }
}

@media (max-width: 920px) {
  .workflow-metrics,
  .workflow-metrics.compact {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .workflow-metric:nth-child(2n) {
    border-right: 0;
  }

  .workflow-metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .merchant-task-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .merchant-decision {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 820px) {
  .sidebar {
    padding: 8px 10px;
  }

  .sidebar-footer {
    display: none;
  }

  .nav-item {
    min-height: 38px;
  }

  .main {
    padding: 0 14px 24px;
  }

  .topbar {
    min-height: 86px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

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

  .security-button span:not(.security-key-dot) {
    display: none;
  }

  .section-tabs {
    margin-right: -14px;
    margin-left: -14px;
    padding-right: 14px;
    padding-left: 14px;
    overflow-x: auto;
  }

  .review-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .review-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .preview-placeholder {
    min-height: 420px;
  }

  .payment-tracking-filter,
  .merchant-filter-bar .payment-tracking-filter {
    position: static;
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .merchant-task-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .workflow-metrics,
  .workflow-metrics.compact,
  .workbench-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .workflow-metric,
  .workflow-metric:nth-child(2n),
  .workbench-task-card,
  .workbench-task-card:nth-child(3) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workflow-metric:last-child,
  .workbench-task-card:last-child {
    border-bottom: 0;
  }

  .merchant-assignment {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .payment-summary-disclosure > summary {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

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