/* Shared CRM controls. Every page rendered in app-main inherits these tokens. */
.shell {
  --crm-accent: #1677ff;
  --crm-accent-dark: #0759c8;
  --crm-ink: #17345f;
  --crm-muted: #657792;
  --crm-line: #dce6f3;
  --crm-canvas: #f4f7fc;
  --crm-surface: #fff;
  --crm-soft: #f7faff;
  --crm-radius: 12px;
  --crm-shadow: 0 3px 16px #123c720d;
  --ui-blue: var(--crm-accent);
  --ui-navy: var(--crm-ink);
  --ui-text: #243553;
  --ui-muted: var(--crm-muted);
  --ui-line: var(--crm-line);
  --ui-bg: var(--crm-canvas);
}

.shell .app-main { background: var(--crm-canvas); color: var(--ui-text); }
/* The global navigation aside rule must not paint content side panels navy. */
.shell .app-main :is(aside.cv2-summary, aside.kyc-side) {
  background: transparent;
  color: var(--ui-text);
  padding: 0;
}
.shell .app-main :is(.panel, .customer-query-panel, .dashboard-panel, .kyc-card, .contract-form-section, .ui-form-section, .finance-card, .cv2-card, .ctv2-card) {
  border-color: var(--crm-line);
  border-radius: var(--crm-radius);
  background-color: var(--crm-surface);
  box-shadow: var(--crm-shadow);
}
.shell .app-main :is(.panel, .customer-query-panel, .dashboard-panel, .kyc-card, .contract-form-section, .ui-form-section, .finance-card, .cv2-card, .ctv2-card) :is(h2, h3) {
  color: var(--crm-ink);
}
.shell .app-main :is(.filters, .phase1-filter-panel, .customer-query-actions, .formbuttons, .actions) {
  row-gap: 10px;
}
.shell .app-main :is(input, select, textarea):not([type='checkbox']):not([type='radio']):not([type='file']) {
  border-color: var(--crm-line);
  border-radius: 8px;
  color: var(--ui-text);
}
.shell .app-main :is(input, select, textarea):not([type='checkbox']):not([type='radio']):focus-visible {
  outline: 0;
  border-color: var(--crm-accent);
  box-shadow: 0 0 0 3px #1677ff24;
}
.shell .app-main :is(button, a, summary):focus-visible {
  outline: 2px solid var(--crm-accent);
  outline-offset: 2px;
}
.shell .app-main button:not(.link):not(:disabled),
.shell .app-main .actions a.download {
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.shell .app-main button.primary {
  border-color: var(--crm-accent);
  background: var(--crm-accent);
  color: #fff;
}
.shell .app-main button.primary:hover:not(:disabled) {
  border-color: var(--crm-accent-dark);
  background: var(--crm-accent-dark);
}
.shell .app-main :is(.tablewrap, .customer-table-wrap) {
  border-color: var(--crm-line);
  border-radius: 9px;
}
.shell .app-main :is(.tablewrap, .customer-table-wrap) table th {
  background: #eff5fc;
  color: #34547d;
  font-weight: 650;
}
.shell .app-main :is(.tablewrap, .customer-table-wrap) table td {
  border-color: #e8eef6;
}
.shell .app-main :is(.tablewrap, .customer-table-wrap) table tbody tr:hover td {
  background: var(--crm-soft);
}
.shell .app-main :is(.tag, .pill, .dashboard-status) { border-radius: 999px; }
.shell .app-main :is(.empty, .dashboard-empty, .kyc-empty) {
  color: var(--crm-muted);
  background: var(--crm-soft);
}

/* The navigation stays consistent as new menu entries are added. */
.shell > .app-sidebar :is(nav > button, .nav-group summary, .nav-submenu button) {
  border-radius: 8px;
  transition: background-color .16s ease, color .16s ease;
}
.shell > .app-sidebar :is(nav > button, .nav-group summary, .nav-submenu button):focus-visible {
  outline: 2px solid #9ed5ff;
  outline-offset: 2px;
}

@media screen and (max-width: 780px) {
  .shell .app-main :is(.filters, .phase1-filter-panel, .actions, .formbuttons) { flex-wrap: wrap; }
  .shell .app-main :is(.panel, .customer-query-panel, .kyc-card, .contract-form-section, .ui-form-section, .cv2-card, .ctv2-card) { padding: 16px; }
}
@media screen and (max-width: 620px) {
  .shell .app-main { padding: 14px; }
  .shell .app-main :is(.filters, .phase1-filter-panel, .customer-query-actions) > :is(label, input, select) {
    min-width: 0;
    max-width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .shell .app-main button,
  .shell > .app-sidebar :is(nav > button, .nav-group summary, .nav-submenu button) { transition: none; }
}
@media print {
  .shell .app-main :is(.panel, .customer-query-panel, .dashboard-panel, .kyc-card, .contract-form-section, .ui-form-section, .finance-card, .cv2-card, .ctv2-card) {
    box-shadow: none;
  }
}
