/* ================= GLOBAL RESET ================= */
* {
  box-sizing: border-box;
}

*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --app-font-sans: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", Arial, ui-sans-serif, system-ui, sans-serif;
  --font-sans: var(--app-font-sans);
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 28px;
  --line-tight: 1.2;
  --line-normal: 1.4;
  --line-relaxed: 1.5;
  --fluent-radius-control: 4px;
  --fluent-radius-card: 8px;
  --fluent-radius-panel: 8px;
  --fluent-shadow-rest: none;
  --fluent-shadow-flyout: 0 8px 16px rgba(0, 0, 0, 0.14);
  --fluent-page-gutter: 24px;
  --fluent-section-gap: 16px;
  --brand-blue: #005baa;
  --brand-blue-dark: #073b74;
  --brand-blue-soft: #e8f3ff;
  --brand-navy: #073b74;
  --brand-charcoal: #242424;
  --brand-slate: #605e5c;
  --brand-slate-dark: #323130;
  --primary: var(--brand-blue);
  --primary-dark: var(--brand-blue-dark);
  --primary-light: var(--brand-blue-soft);
  --tenant-primary: var(--primary);
  --tenant-secondary: var(--primary-dark);
  --tenant-primary-color: var(--primary);
  --tenant-primary-dark: var(--primary-dark);
  --tenant-primary-soft: var(--primary-light);
  --tenant-accent-color: #2f80d7;
  --tenant-sidebar-color: #f3f2f1;
  --tenant-header-color: var(--primary);
  --tenant-topbar-color: var(--tenant-header-color);
  --tenant-topbar-active-color: rgba(255, 255, 255, 0.2);
  --tenant-button-color: var(--primary);
  --tenant-portal-primary-color: var(--primary);
  --tenant-text-color: var(--brand-charcoal);
  --tenant-heading-color: var(--brand-navy);
  --tenant-muted-text-color: var(--brand-slate);
  --tenant-sidebar-text-color: var(--brand-slate-dark);
  --tenant-topbar-text-color: #ffffff;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #faf9f8;
  --surface-hover: #edebe9;
  --text: var(--brand-charcoal);
  --heading: var(--brand-navy);
  --muted: var(--brand-slate);
  --border: #d1d1d1;
  --soft-border: #e5e5e5;
  --danger: #b42318;
  --warning: #b54708;
  --success: #005baa;
  --radius: var(--fluent-radius-control);
  --admin-command-bg: var(--primary);
  --admin-sidebar-bg: #f3f2f1;
  --admin-content-bg: #ffffff;
  --admin-selected-bg: #e8f3ff;
  --admin-hover-bg: #edebe9;
  --admin-border: #d1d1d1;
  --admin-soft-border: #e5e5e5;
  --admin-accent: #005baa;
  --admin-link: #005baa;
  --admin-text: #242424;
  --admin-nav-text: #323130;
  --admin-muted: #605e5c;
}

html,
body,
#root {
  min-height: 100%;
  width: 100%;
}

html {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--line-normal);
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--tenant-text-color, var(--text));
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 400;
  letter-spacing: 0;
}

#root,
#root *:not(svg):not(path) {
  font-family: var(--font-sans) !important;
}

#root code,
#root pre,
#root kbd,
#root samp {
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace !important;
}

#root {
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
  margin-top: 0;
}

h1 {
  color: var(--tenant-heading-color, var(--heading));
  font-size: 28px;
  line-height: var(--line-tight);
  font-weight: 700;
  letter-spacing: 0;
}

h2 {
  color: var(--tenant-heading-color, var(--heading));
  font-size: 21px;
  line-height: var(--line-tight);
  font-weight: 600;
  letter-spacing: 0;
}

h3 {
  color: var(--tenant-heading-color, var(--heading));
  font-size: 17px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: 0;
}

p {
  color: var(--tenant-muted-text-color, var(--muted));
  line-height: var(--line-relaxed);
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  font-size: var(--text-sm);
  font-weight: 600;
}

input,
select,
textarea {
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 400;
}

label {
  font-size: var(--text-sm);
  font-weight: 500;
}

table {
  font-size: var(--text-sm);
}

th {
  font-size: var(--text-xs);
  font-weight: 600;
}

td {
  font-weight: 400;
}

/* Tenant text theme bridge.
   Many CRM pages use inline JS styles, so these targeted overrides let each
   organization's text colors apply without disturbing red errors or warning badges. */
#root [style*='color: "#0A1824"'],
#root [style*='color: "#121821"'],
#root [style*='color: "#10233f"'],
#root [style*='color: "#111827"'],
#root [style*='color: "#003B73"'],
#root [style*='color: "#0B2F5B"'],
#root [style*='color: "#172033"'],
#root [style*="color: #0a1824"],
#root [style*="color: #121821"],
#root [style*="color: #10233f"],
#root [style*="color: #111827"],
#root [style*="color: #003b73"],
#root [style*="color: #0b2f5b"],
#root [style*="color: #172033"],
#root [style*="color: rgb(0, 59, 115)"],
#root [style*="color: rgb(10, 24, 36)"],
#root [style*="color: rgb(18, 24, 33)"],
#root [style*="color: rgb(16, 35, 63)"],
#root [style*="color: rgb(17, 24, 39)"],
#root [style*="color: rgb(11, 47, 91)"],
#root [style*="color: rgb(23, 32, 51)"] {
  color: var(--tenant-heading-color, var(--heading)) !important;
}

#root [style*='color: "#2F3A45"'],
#root [style*='color: "#334155"'],
#root [style*='color: "#1f3654"'],
#root [style*="color: #2f3a45"],
#root [style*="color: #334155"],
#root [style*="color: #1f3654"],
#root [style*="color: rgb(47, 58, 69)"],
#root [style*="color: rgb(51, 65, 85)"],
#root [style*="color: rgb(31, 54, 84)"] {
  color: var(--tenant-text-color, var(--text)) !important;
}

#root [style*='color: "#5E6868"'],
#root [style*='color: "#6B7280"'],
#root [style*='color: "#64748b"'],
#root [style*='color: "#475569"'],
#root [style*='color: "#8B9493"'],
#root [style*='color: "#667085"'],
#root [style*="color: #5e6868"],
#root [style*="color: #6b7280"],
#root [style*="color: #64748b"],
#root [style*="color: #475569"],
#root [style*="color: #8b9493"],
#root [style*="color: #667085"],
#root [style*="color: rgb(94, 104, 104)"],
#root [style*="color: rgb(107, 114, 128)"],
#root [style*="color: rgb(100, 116, 139)"],
#root [style*="color: rgb(71, 85, 105)"],
#root [style*="color: rgb(139, 148, 147)"],
#root [style*="color: rgb(102, 112, 133)"] {
  color: var(--tenant-muted-text-color, var(--muted)) !important;
}

#root [style*="background: #f4f7fa"],
#root [style*="background: #F4F7FA"],
#root [style*="background-color: #f4f7fa"],
#root [style*="background-color: #F4F7FA"],
#root [style*="background: #f5f7fb"],
#root [style*="background: #F5F7FB"],
#root [style*="background-color: #f5f7fb"],
#root [style*="background-color: #F5F7FB"],
#root [style*="background: rgb(244, 247, 250)"],
#root [style*="background-color: rgb(244, 247, 250)"],
#root [style*="background: rgb(245, 247, 251)"],
#root [style*="background-color: rgb(245, 247, 251)"] {
  background: var(--bg) !important;
}

#root [style*="background: #f0f5fa"],
#root [style*="background: #F0F5FA"],
#root [style*="background-color: #f0f5fa"],
#root [style*="background-color: #F0F5FA"],
#root [style*="background: #edf3f8"],
#root [style*="background: #EDF3F8"],
#root [style*="background-color: #edf3f8"],
#root [style*="background-color: #EDF3F8"],
#root [style*="background: rgb(240, 245, 250)"],
#root [style*="background-color: rgb(240, 245, 250)"],
#root [style*="background: rgb(237, 243, 248)"],
#root [style*="background-color: rgb(237, 243, 248)"] {
  background: var(--surface-muted) !important;
}

#root [style*="background: #005baa"],
#root [style*="background: #005BAA"],
#root [style*="background: #1658b7"],
#root [style*="background: #1658B7"],
#root [style*="background-color: #005baa"],
#root [style*="background-color: #005BAA"],
#root [style*="background-color: #1658b7"],
#root [style*="background-color: #1658B7"],
#root [style*="background: rgb(0, 91, 170)"],
#root [style*="background-color: rgb(0, 91, 170)"],
#root [style*="background: rgb(22, 88, 183)"],
#root [style*="background-color: rgb(22, 88, 183)"] {
  background: var(--tenant-button-color, var(--tenant-primary-color, var(--primary))) !important;
}

#root [style*="border: 1px solid #005baa"],
#root [style*="border: 1px solid #005BAA"],
#root [style*="border: 1px solid rgb(0, 91, 170)"],
#root [style*="border-color: #005baa"],
#root [style*="border-color: #005BAA"],
#root [style*="border-color: rgb(0, 91, 170)"],
#root [style*="border-top: 4px solid #1f6f85"],
#root [style*="border-top: 4px solid #1F6F85"],
#root [style*="border-top: 4px solid rgb(31, 111, 133)"],
#root [style*="border-bottom: 4px solid #005baa"],
#root [style*="border-bottom: 4px solid #005BAA"],
#root [style*="border-bottom: 4px solid rgb(0, 91, 170)"],
#root [style*="border-left: 3px solid #005baa"],
#root [style*="border-left: 3px solid #005BAA"],
#root [style*="border-left: 3px solid rgb(0, 91, 170)"] {
  border-color: var(--tenant-primary-color, var(--primary)) !important;
}

#root [style*="border: 1px solid #D4DEE9"],
#root [style*="border: 1px solid #d4dee9"],
#root [style*="border: 1px solid #cbd5e1"],
#root [style*="border: 1px solid #CBD5E1"],
#root [style*="border: 1px solid #E4EBF2"],
#root [style*="border: 1px solid #e4ebf2"],
#root [style*="border: 1px solid #B9CBE0"],
#root [style*="border: 1px solid #b9cbe0"],
#root [style*="border: 1px solid #bfdbfe"],
#root [style*="border: 1px solid rgb(212, 222, 233)"],
#root [style*="border: 1px solid rgb(203, 213, 225)"],
#root [style*="border: 1px solid rgb(228, 235, 242)"],
#root [style*="border: 1px solid rgb(185, 203, 224)"],
#root [style*="border: 1px solid rgb(191, 219, 254)"],
#root [style*="border-color: #D4DEE9"],
#root [style*="border-color: #d4dee9"],
#root [style*="border-color: #cbd5e1"],
#root [style*="border-color: #CBD5E1"],
#root [style*="border-color: #E4EBF2"],
#root [style*="border-color: #e4ebf2"],
#root [style*="border-color: #B9CBE0"],
#root [style*="border-color: #b9cbe0"],
#root [style*="border-color: rgb(212, 222, 233)"],
#root [style*="border-color: rgb(203, 213, 225)"],
#root [style*="border-color: rgb(228, 235, 242)"],
#root [style*="border-color: rgb(185, 203, 224)"],
#root [style*="border-bottom: 1px solid #D4DEE9"],
#root [style*="border-bottom: 1px solid #d4dee9"],
#root [style*="border-bottom: 1px solid rgb(212, 222, 233)"],
#root [style*="border-top: 1px solid #D4DEE9"],
#root [style*="border-top: 1px solid #d4dee9"],
#root [style*="border-top: 1px solid rgb(212, 222, 233)"],
#root [style*="border-right: 1px solid #D4DEE9"],
#root [style*="border-right: 1px solid #d4dee9"],
#root [style*="border-right: 1px solid rgb(212, 222, 233)"],
#root [style*="border-left: 1px solid #D4DEE9"],
#root [style*="border-left: 1px solid #d4dee9"],
#root [style*="border-left: 1px solid rgb(212, 222, 233)"] {
  border-color: var(--border) !important;
}

#root [style*="background: #eaf4ff"],
#root [style*="background: #EAF4FF"],
#root [style*="background: #e8f3ff"],
#root [style*="background: #E8F3FF"],
#root [style*="background: #e8f2ff"],
#root [style*="background: #E8F2FF"],
#root [style*="background: #dbeafe"],
#root [style*="background-color: #eaf4ff"],
#root [style*="background-color: #EAF4FF"],
#root [style*="background-color: #e8f3ff"],
#root [style*="background-color: #E8F3FF"],
#root [style*="background-color: #e8f2ff"],
#root [style*="background-color: #E8F2FF"],
#root [style*="background-color: #dbeafe"],
#root [style*="background: rgb(234, 244, 255)"],
#root [style*="background-color: rgb(234, 244, 255)"],
#root [style*="background: rgb(232, 243, 255)"],
#root [style*="background-color: rgb(232, 243, 255)"],
#root [style*="background: rgb(219, 234, 254)"],
#root [style*="background-color: rgb(219, 234, 254)"] {
  background: var(--tenant-primary-soft, var(--primary-light)) !important;
}

#root [style*="color: #005baa"],
#root [style*="color: #005BAA"],
#root [style*="color: #1658b7"],
#root [style*="color: #1658B7"],
#root [style*="color: rgb(0, 91, 170)"],
#root [style*="color: rgb(22, 88, 183)"] {
  color: var(--tenant-primary-color, var(--primary)) !important;
}

/* Lainac brand bridge: older QuickBooks-style screens used green action and
   status colors. Render those values with the company logo blue instead. */
#root [style*="background: #00892e"],
#root [style*="background: #00892E"],
#root [style*="background: #16a34a"],
#root [style*="background: #10b981"],
#root [style*="background: #059669"],
#root [style*="background-color: #00892e"],
#root [style*="background-color: #00892E"],
#root [style*="background-color: #16a34a"],
#root [style*="background-color: #10b981"],
#root [style*="background-color: #059669"],
#root [style*="background: rgb(0, 137, 46)"],
#root [style*="background: rgb(22, 163, 74)"],
#root [style*="background: rgb(16, 185, 129)"],
#root [style*="background: rgb(5, 150, 105)"] {
  background: var(--tenant-button-color, var(--tenant-primary-color, var(--primary))) !important;
}

#root [style*="background: #dcfce7"],
#root [style*="background: #ecfdf5"],
#root [style*="background: #f0fdf4"],
#root [style*="background: #d4edda"],
#root [style*="background: #d9fddf"],
#root [style*="background-color: #dcfce7"],
#root [style*="background-color: #ecfdf5"],
#root [style*="background-color: #f0fdf4"],
#root [style*="background-color: #d4edda"],
#root [style*="background-color: #d9fddf"],
#root [style*="background: rgb(220, 252, 231)"],
#root [style*="background: rgb(236, 253, 245)"],
#root [style*="background: rgb(240, 253, 244)"],
#root [style*="background: rgb(212, 237, 218)"],
#root [style*="background: rgb(217, 253, 223)"] {
  background: var(--tenant-primary-soft, var(--primary-light)) !important;
}

#root [style*="color: #00892e"],
#root [style*="color: #00892E"],
#root [style*="color: #166534"],
#root [style*="color: #047857"],
#root [style*="color: #059669"],
#root [style*="color: #067a2f"],
#root [style*="color: #16a34a"],
#root [style*="color: #10b981"],
#root [style*="color: rgb(0, 137, 46)"],
#root [style*="color: rgb(22, 101, 52)"],
#root [style*="color: rgb(4, 120, 87)"],
#root [style*="color: rgb(5, 150, 105)"],
#root [style*="color: rgb(6, 122, 47)"],
#root [style*="color: rgb(22, 163, 74)"],
#root [style*="color: rgb(16, 185, 129)"] {
  color: var(--tenant-primary-color, var(--primary)) !important;
}

#root [style*="border: 1px solid #00892e"],
#root [style*="border: 1px solid #00892E"],
#root [style*="border: 1px solid #bbf7d0"],
#root [style*="border: 1px solid #86efac"],
#root [style*="border: 1px solid #10b981"],
#root [style*="border: 2px solid #10b981"],
#root [style*="border-color: #00892e"],
#root [style*="border-color: #00892E"],
#root [style*="border-color: #bbf7d0"],
#root [style*="border-color: #86efac"],
#root [style*="border-color: #10b981"],
#root [style*="border: 1px solid rgb(0, 137, 46)"],
#root [style*="border: 1px solid rgb(187, 247, 208)"],
#root [style*="border: 1px solid rgb(134, 239, 172)"],
#root [style*="border-color: rgb(0, 137, 46)"],
#root [style*="border-color: rgb(187, 247, 208)"],
#root [style*="border-color: rgb(134, 239, 172)"] {
  border-color: var(--tenant-primary-color, var(--primary)) !important;
}

strong,
b {
  font-weight: 600;
}

/* Professional CRM/ERP typography. The app uses many inline styles, so this
   scoped shell rule keeps dashboard pages consistent without editing every
   module one by one. */
.crm-app-shell,
.crm-app-shell *:not(svg):not(path) {
  font-family: var(--font-sans) !important;
}

.crm-app-shell {
  font-size: var(--text-base);
  line-height: var(--line-normal);
  font-weight: 400;
  letter-spacing: 0;
}

.crm-app-shell h1 {
  font-size: 28px !important;
  line-height: var(--line-tight) !important;
  font-weight: 650 !important;
}

.crm-app-shell h2 {
  font-size: 20px !important;
  line-height: var(--line-tight) !important;
  font-weight: 600 !important;
}

.crm-app-shell h3 {
  font-size: 16px !important;
  line-height: 1.32 !important;
  font-weight: 600 !important;
}

.crm-app-shell p,
.crm-app-shell li {
  font-size: var(--text-sm) !important;
}

.crm-app-shell button,
.crm-app-shell input,
.crm-app-shell select,
.crm-app-shell textarea {
  font-size: var(--text-sm) !important;
}

.crm-app-shell button {
  font-weight: 600 !important;
}

.crm-app-shell input,
.crm-app-shell select,
.crm-app-shell textarea {
  font-weight: 400 !important;
}

.crm-app-shell label {
  font-size: var(--text-sm) !important;
  font-weight: 500 !important;
}

.crm-app-shell table,
.crm-app-shell td {
  font-size: var(--text-sm) !important;
}

.crm-app-shell th {
  font-size: var(--text-xs) !important;
  font-weight: 600 !important;
}

.crm-app-shell strong,
.crm-app-shell b {
  font-weight: 600 !important;
}

.crm-app-shell [style*="font-weight: 900"],
.crm-app-shell [style*="font-weight: 800"],
.crm-app-shell [style*="font-weight: 750"] {
  font-weight: 600 !important;
}

.crm-app-shell [style*="font-weight: 700"],
.crm-app-shell [style*="font-weight: 650"] {
  font-weight: 550 !important;
}

.crm-app-shell [style*="font-weight: 600"] {
  font-weight: 550 !important;
}

.crm-app-shell [style*="letter-spacing"] {
  letter-spacing: 0 !important;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--fluent-radius-card);
  padding: 16px;
  box-shadow: none;
}

.card h3,
.card-title {
  font-size: 17px;
  font-weight: 600;
}

/* Microsoft Entra-style CRM admin architecture. Use these classes for new
   screens and when touching existing modules. */
.crm-admin-page {
  min-height: 100%;
  background: var(--admin-content-bg);
  color: var(--admin-text);
}

.crm-page-header {
  display: grid;
  gap: 4px;
  padding: 2px 0 14px;
  border-bottom: 1px solid var(--admin-soft-border);
}

.crm-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.4;
}

.crm-page-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.crm-page-title-row svg {
  color: var(--admin-accent);
  flex: 0 0 auto;
}

.crm-page-title {
  margin: 0;
  color: var(--admin-text);
  font-size: 28px;
  font-weight: 650;
  line-height: 1.2;
}

.crm-page-subtitle {
  margin: 0;
  color: var(--admin-muted);
  font-size: 13px;
}

.crm-command-row,
.crm-toolbar {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--admin-soft-border);
  padding: 8px 0;
}

.crm-icon-button,
.crm-text-button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--admin-link);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 0 9px;
}

.crm-icon-button {
  width: 32px;
  padding: 0;
}

.crm-text-button:hover,
.crm-icon-button:hover {
  background: var(--admin-hover-bg);
}

.crm-primary-button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--admin-accent);
  border-radius: 2px;
  background: var(--admin-accent);
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 0 12px;
}

.crm-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 0;
}

.crm-search-input,
.crm-select,
.crm-input {
  min-height: 32px;
  border: 1px solid #8a8886;
  border-radius: 2px;
  background: #ffffff;
  color: var(--admin-text);
  font-size: 14px;
  padding: 0 10px;
}

.crm-search-input {
  min-width: 260px;
}

.crm-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #eff6fc;
  border: 1px solid #deecf9;
  color: var(--admin-text);
  padding: 12px 16px;
  font-size: 13px;
}

.crm-data-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

.crm-data-table th,
.crm-data-table td {
  border-bottom: 1px solid var(--admin-soft-border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

.crm-data-table th {
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 600;
  background: #ffffff;
}

.crm-data-table td {
  color: var(--admin-text);
  font-size: 13px;
}

.crm-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border: 1px solid var(--admin-border);
  border-radius: 2px;
  color: var(--admin-text);
  background: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 0 7px;
}

.crm-page-content table {
  border-collapse: collapse;
}

.crm-page-content th {
  background: #ffffff !important;
  color: var(--admin-text) !important;
  border-bottom-color: var(--admin-soft-border) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

.crm-page-content td {
  border-bottom-color: var(--admin-soft-border) !important;
  color: var(--admin-text) !important;
  font-size: 13px !important;
}

.crm-page-content [style*="box-shadow"] {
  box-shadow: none !important;
}

.crm-page-content [style*="border-radius: 10px"],
.crm-page-content [style*="border-radius: 12px"],
.crm-page-content [style*="border-radius: 14px"],
.crm-page-content [style*="border-radius: 16px"] {
  border-radius: var(--fluent-radius-card) !important;
}

/* Microsoft Fluent architecture layer.
   Existing pages use a lot of inline styles, so these rules normalize the
   whole SaaS toward Segoe UI, compact controls, flat cards, and consistent
   enterprise dashboard spacing. */
#root :where(main, [role="main"]) {
  color: var(--admin-text);
}

#root :where(button, [role="button"]) {
  min-height: 32px;
  border-radius: var(--fluent-radius-control);
  font-size: var(--text-sm) !important;
  font-weight: 600 !important;
  line-height: 1.2;
}

#root :where(input, select, textarea) {
  min-height: 32px;
  border-radius: var(--fluent-radius-control);
  font-size: var(--text-base) !important;
  line-height: 1.3;
}

#root :where(table) {
  border-collapse: collapse;
}

#root :where(th, td) {
  padding-top: 8px;
  padding-bottom: 8px;
}

#root :where(h1, h2, h3, h4, h5, h6, p, label, small, span, button, input, select, textarea, th, td, a) {
  letter-spacing: 0 !important;
}

#root [style*="font-family"] {
  font-family: var(--font-sans) !important;
}

/* SaaS admin Fluent layer.
   Admin pages still contain page-local inline style objects, so this scoped
   layer keeps every /admin-dashboard page on one Microsoft-like architecture. */
.admin-shell,
.admin-shell *:not(svg):not(path) {
  font-family: var(--font-sans) !important;
  letter-spacing: 0 !important;
}

.admin-shell {
  background: #f3f2f1 !important;
  color: var(--admin-text) !important;
  font-size: var(--text-base);
}

.admin-content {
  color: var(--admin-text) !important;
}

.admin-content :where(h1) {
  color: var(--brand-navy) !important;
  font-size: 22px !important;
  font-weight: 600 !important;
  line-height: 28px !important;
}

.admin-content :where(h2) {
  color: var(--brand-navy) !important;
  font-size: 20px !important;
  font-weight: 600 !important;
  line-height: 26px !important;
}

.admin-content :where(h3) {
  color: var(--brand-navy) !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 22px !important;
}

.admin-content :where(p, label, small, span, a, li) {
  line-height: 1.4;
}

.admin-content :where(p, small) {
  color: var(--admin-muted) !important;
}

.admin-content :where(button, [role="button"]) {
  min-height: 32px !important;
  border-radius: 4px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

.admin-content :where(input, select, textarea) {
  min-height: 32px !important;
  border-radius: 4px !important;
  border-color: #c8c6c4 !important;
  color: var(--admin-text) !important;
  background: #ffffff !important;
  font-size: 14px !important;
  font-weight: 400 !important;
}

.admin-content :where(table) {
  background: #ffffff;
  font-size: 13px !important;
}

.admin-content :where(th) {
  background: #faf9f8 !important;
  color: var(--admin-nav-text) !important;
  border-color: var(--admin-soft-border) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

.admin-content :where(td) {
  color: var(--admin-text) !important;
  border-color: var(--admin-soft-border) !important;
  font-size: 13px !important;
  font-weight: 400 !important;
}

.admin-content [style*="box-shadow"] {
  box-shadow: none !important;
}

.admin-content :where(section, article, aside, div)[style*="border-radius: 10px"],
.admin-content :where(section, article, aside, div)[style*="border-radius: 12px"],
.admin-content :where(section, article, aside, div)[style*="border-radius: 14px"],
.admin-content :where(section, article, aside, div)[style*="border-radius: 16px"],
.admin-content :where(section, article, aside, div)[style*="border-radius: 18px"],
.admin-content :where(section, article, aside, div)[style*="border-radius: 20px"],
.admin-content :where(section, article, aside, div)[style*="border-radius: 22px"],
.admin-content :where(section, article, aside, div)[style*="border-radius: 24px"] {
  border-radius: 8px !important;
}

.admin-content :where(button, input, select, textarea)[style*="border-radius: 6px"],
.admin-content :where(button, input, select, textarea)[style*="border-radius: 8px"],
.admin-content :where(button, input, select, textarea)[style*="border-radius: 10px"],
.admin-content :where(button, input, select, textarea)[style*="border-radius: 12px"] {
  border-radius: 4px !important;
}

.admin-content :where(section, article, aside, div, form)[style*="border: 1px solid"] {
  border-color: var(--admin-border) !important;
}

.admin-content [style*="font-weight: 800"],
.admin-content [style*="font-weight: 700"] {
  font-weight: 600 !important;
}

.admin-content [style*="background: #0A1824"] {
  background: var(--admin-accent) !important;
}

.admin-content :where(div, p, td, th, span, label, small, strong)[style*="color: #0A1824"],
.admin-content :where(div, p, td, th, span, label, small, strong)[style*="color: #003B73"] {
  color: var(--admin-text) !important;
}

.admin-content :where(button, a)[style*="color: #003B73"],
.admin-content :where(button, a)[style*="color: #0A1824"] {
  color: var(--brand-navy) !important;
}

.admin-content :where(button)[style*="background: #F0F5FA"],
.admin-content :where(button)[style*="background: #f6f9fd"],
.admin-content :where(button)[style*="background: #E4EBF2"] {
  background: #ffffff !important;
  border-color: #c8c6c4 !important;
}

.admin-content [style*="background: #F0F5FA"],
.admin-content [style*="background: #f8fafc"],
.admin-content [style*="background: #F8FBFE"],
.admin-content [style*="background: #EAF1F8"] {
  background: #faf9f8 !important;
}

#root [style*="box-shadow"] {
  box-shadow: var(--fluent-shadow-rest) !important;
}

#root [role="menu"][style],
#root [role="dialog"][style],
#root [aria-modal="true"][style] {
  box-shadow: var(--fluent-shadow-flyout) !important;
}

#root :where(main, section, article, aside, div)[style*="border-radius: 10px"],
#root :where(main, section, article, aside, div)[style*="border-radius: 12px"],
#root :where(main, section, article, aside, div)[style*="border-radius: 14px"],
#root :where(main, section, article, aside, div)[style*="border-radius: 16px"],
#root :where(main, section, article, aside, div)[style*="border-radius: 18px"],
#root :where(main, section, article, aside, div)[style*="border-radius: 20px"],
#root :where(main, section, article, aside, div)[style*="border-radius: 22px"],
#root :where(main, section, article, aside, div)[style*="border-radius: 24px"] {
  border-radius: var(--fluent-radius-card) !important;
}

#root :where(button, input, select, textarea)[style*="border-radius: 8px"],
#root :where(button, input, select, textarea)[style*="border-radius: 10px"],
#root :where(button, input, select, textarea)[style*="border-radius: 12px"],
#root :where(button, input, select, textarea)[style*="border-radius: 14px"],
#root :where(button, input, select, textarea)[style*="border-radius: 16px"] {
  border-radius: var(--fluent-radius-control) !important;
}

#root :where(section, article, aside, div)[style*="border: 1px solid"] {
  border-color: var(--admin-border) !important;
}

/* App-wide SaaS typography scale.
   Many pages use inline JS styles, so these guardrails keep typography consistent
   without editing every module one by one. */
#root :where(button, input, select, textarea) {
  font-size: var(--text-sm);
}

#root :where(button) {
  font-weight: 600 !important;
}

#root :where(input, select, textarea) {
  font-weight: 400 !important;
}

#root :where(p, a) {
  font-size: var(--text-base);
}

#root :where(table, td) {
  font-size: var(--text-sm);
}

#root :where(label, small) {
  font-size: var(--text-sm);
}

#root :where(th) {
  font-size: var(--text-xs);
}

#root [style*="font-weight: 900"],
#root [style*="font-weight: 800"],
#root [style*="font-weight: 750"] {
  font-weight: 600 !important;
}

#root [style*="font-weight: 700"],
#root [style*="font-weight: 650"] {
  font-weight: 550 !important;
}

#root [style*="font-weight: 600"] {
  font-weight: 550 !important;
}

#root [style*="font-size: 48px"],
#root [style*="font-size: 44px"],
#root [style*="font-size: 42px"],
#root [style*="font-size: 40px"],
#root [style*="font-size: 38px"],
#root [style*="font-size: 36px"] {
  font-size: 28px !important;
}

#root [style*="font-size: 34px"] {
  font-size: 28px !important;
}

#root [style*="font-size: 32px"] {
  font-size: 28px !important;
}

#root [style*="font-size: 30px"] {
  font-size: 28px !important;
}

#root [style*="font-size: 28px"] {
  font-size: 24px !important;
}

#root [style*="font-size: 27px"],
#root [style*="font-size: 26px"],
#root [style*="font-size: 25px"] {
  font-size: 24px !important;
}

#root [style*="font-size: 24px"] {
  font-size: 23px !important;
}

#root [style*="font-size: 22px"] {
  font-size: 21px !important;
}

#root [style*="font-size: 21px"] {
  font-size: 20px !important;
}

#root [style*="font-size: 20px"] {
  font-size: 19px !important;
}

#root [style*="font-size: 18px"] {
  font-size: 17px !important;
}

#root [style*="font-size: 17px"] {
  font-size: 16px !important;
}

#root [style*="font-size: 16px"] {
  font-size: 15px !important;
}

#root [style*="font-size: 15px"] {
  font-size: 14px !important;
}

#root [style*="font-size: 14px"] {
  font-size: 14px !important;
}

#root [style*="font-size: 13px"] {
  font-size: 13px !important;
}

#root [style*="font-size: 12px"],
#root [style*="font-size: 11px"],
#root [style*="font-size: 10px"],
#root [style*="font-size: 10.5px"] {
  font-size: 12px !important;
}

/* Final admin overrides must sit after the generic inline-style guards above. */
#root .admin-content h1 {
  color: var(--brand-navy) !important;
  font-size: 22px !important;
  font-weight: 600 !important;
  line-height: 28px !important;
}

#root .admin-content h2 {
  color: var(--brand-navy) !important;
  font-size: 20px !important;
  font-weight: 600 !important;
  line-height: 26px !important;
}

#root .admin-content h3 {
  color: var(--brand-navy) !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 22px !important;
}

#root .admin-content button,
#root .admin-content [role="button"] {
  min-height: 32px !important;
  border-radius: 4px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

#root .admin-content input,
#root .admin-content select,
#root .admin-content textarea {
  min-height: 32px !important;
  border-radius: 4px !important;
  border-color: #c8c6c4 !important;
  color: var(--admin-text) !important;
  font-size: 14px !important;
  font-weight: 400 !important;
}

#root .admin-content th {
  background: #faf9f8 !important;
  color: var(--admin-nav-text) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

#root .admin-content td {
  color: var(--admin-text) !important;
  font-size: 13px !important;
  font-weight: 400 !important;
}

#root .admin-content [style*="font-size: 24px"],
#root .admin-content [style*="font-size: 22px"] {
  font-size: 22px !important;
}

#root .admin-content [style*="font-size: 20px"],
#root .admin-content [style*="font-size: 18px"] {
  font-size: 16px !important;
}

#root .admin-content [style*="font-weight: 800"],
#root .admin-content [style*="font-weight: 700"] {
  font-weight: 600 !important;
}

.container {
  width: 100%;
  padding: 18px;
}

.auth-page {
  min-height: 100dvh !important;
  width: 100%;
}

.auth-card {
  max-width: calc(100vw - 24px) !important;
}

.crm-page-content {
  min-width: 0;
}

.crm-page-content > * {
  max-width: 100%;
}

.crm-page-content [style*="overflow-x: auto"],
.crm-page-content [style*="overflow: auto"] {
  max-width: 100% !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

@media (max-width: 1024px) {
  html {
    font-size: var(--text-base);
  }

  .container {
    padding: 14px;
  }

  .crm-app-shell {
    font-size: var(--text-base);
  }
}

@media (max-width: 720px) {
  html {
    font-size: var(--text-base);
  }

  h1,
  .crm-app-shell h1 {
    font-size: 23px !important;
  }

  h2,
  .crm-app-shell h2 {
    font-size: 19px !important;
  }

  .container {
    padding: 10px;
  }

  .crm-app-shell button,
  .crm-app-shell input,
  .crm-app-shell select,
  .crm-app-shell textarea {
    font-size: var(--text-sm) !important;
  }

  .auth-page {
    min-height: 100dvh !important;
    align-items: flex-start !important;
    padding: 14px 10px !important;
  }

  .auth-page-split {
    display: block !important;
  }

  .auth-page-split > section:first-child {
    display: none !important;
  }

  .auth-page-split > section {
    min-height: 100dvh !important;
    padding: 14px 10px !important;
  }

  .auth-card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 10px !important;
    padding: 22px 16px !important;
    box-shadow: 0 10px 28px rgba(15, 35, 63, 0.1) !important;
  }

  .auth-card img {
    max-width: 170px !important;
    max-height: 70px !important;
  }

  .crm-app-shell {
    width: 100%;
    min-height: 100dvh;
    overflow: hidden;
  }

  .crm-page-content {
    max-width: 100vw;
    overflow-x: hidden !important;
  }

  .crm-page-content button,
  .crm-page-content input,
  .crm-page-content select,
  .crm-page-content textarea {
    min-height: 38px;
  }

  .crm-page-content [style*="grid-template-columns"][style*="minmax(260px"],
  .crm-page-content [style*="grid-template-columns"][style*="minmax(280px"],
  .crm-page-content [style*="grid-template-columns"][style*="minmax(300px"],
  .crm-page-content [style*="grid-template-columns"][style*="minmax(310px"],
  .crm-page-content [style*="grid-template-columns"][style*="minmax(320px"],
  .crm-page-content [style*="grid-template-columns"][style*="minmax(330px"],
  .crm-page-content [style*="grid-template-columns"][style*="minmax(340px"],
  .crm-page-content [style*="grid-template-columns"][style*="minmax(360px"],
  .crm-page-content [style*="grid-template-columns"][style*="minmax(380px"],
  .crm-page-content [style*="grid-template-columns"][style*="minmax(420px"],
  .crm-page-content [style*="grid-template-columns"][style*="repeat(2"],
  .crm-page-content [style*="grid-template-columns"][style*="repeat(3"] {
    grid-template-columns: 1fr !important;
  }

  .crm-page-content [style*="display: flex"][style*="justify-content: space-between"] {
    gap: 10px !important;
    flex-wrap: wrap !important;
  }

  .crm-page-content table {
    white-space: nowrap;
  }
}

.reminder {
  padding: 12px;
  margin: 10px 0;
  border-radius: var(--radius);
  font-weight: 700;
}

.yellow {
  background: #fff3cd;
}

.red {
  background: #f8d7da;
}

.green {
  background: var(--tenant-primary-soft, var(--primary-light));
}
