/* Mythril Theme — Full sage palette override */

:root,
[data-theme="light"] {
	/* Gray scale: cold gray → warm sage */
	--gray-50: #fafaf8;
	--gray-100: #f8f7f4;
	--gray-200: #e8e6e1;
	--gray-300: #dddbd4;
	--gray-400: #d4d1bf;
	--gray-500: #8b8e84;
	--gray-600: #6b7280;
	--gray-700: #4b5563;
	--gray-800: #2d3340;
	--gray-900: #1a1f2e;

	--neutral-white: #f8f7f4;
	--neutral-black: #1a1f2e;
	--neutral: #fafaf8;
	--invert-neutral: #1a1f2e;

	/* --primary → #333d36 */
	--primary: #333d36;
	--primary-color: #333d36;
	--brand-color: #333d36;
	--btn-primary: #333d36;
	--border-primary: #333d36;
	--checkbox-color: #333d36;
	--checkbox-gradient: linear-gradient(180deg, #333d36, #333d36);

	/* --background → #f8f7f4 */
	--bg-color: #f8f7f4;

	/* --card → warm off-white from palette */
	--fg-color: #fafaf8;
	--card-bg: #fafaf8;

	/* --popover / modal → match bg */
	--popover-bg: #f8f7f4;
	--modal-bg: #f8f7f4;
	--toast-bg: #f8f7f4;
	--surface-modal: #f8f7f4;
	--surface-white: #f8f7f4;

	/* --sidebar → #fafaf8 */
	--navbar-bg: #fafaf8;
	--surface-menu-bar: #fafaf8;

	/* --foreground / --card-foreground → #1a1f2e */
	--heading-color: #1a1f2e;
	--text-color: #1a1f2e;
	--text-neutral: #1a1f2e;
	--icon-stroke: #1a1f2e;

	/* --muted-foreground → #6b7280 */
	--text-muted: #6b7280;
	--text-light: #6b7280;
	--disabled-text-color: #9ca3af;

	/* --muted → #e8e6e1 */
	--control-bg: #e8e6e1;
	--control-bg-on-gray: #dddbd4;
	--subtle-fg: #e8e6e1;
	--disabled-control-bg: #e8e6e1;
	--input-disabled-bg: #e8e6e1;

	/* --accent / --secondary → #d4d1bf */
	--subtle-accent: #fafaf8;
	--fg-hover-color: #e8e6e1;
	--sidebar-select-color: #e8e6e1;
	--switch-bg: #d4d1bf;

	/* --input → warm off-white */
	--awesomebar-focus-bg: #fafaf8;
	--awesomplete-hover-bg: #e8e6e1;

	/* --border → #e8e6e1 */
	--border-color: #e8e6e1;
	--dark-border-color: #d4d1bf;
	--table-border-color: #e8e6e1;
	--btn-group-border-color: #d4d1bf;
	--shadow-inset: inset 0px -1px 0px #d4d1bf;

	/* --secondary → #d4d1bf (default button bg) */
	--btn-default-bg: #d4d1bf;
	--btn-default-hover-bg: #c5c2af;

	/* --destructive → #c73e3a */
	--danger: #c73e3a;

	/* --ring → #7c9082 */
	--checkbox-focus-shadow: 0 0 0 2px #7c9082;
	--highlight-shadow: 1px 1px 10px rgba(124, 144, 130, 0.15), 0 0 4px #7c9082;

	/* Scrollbar */
	--scrollbar-thumb-color: #d4d1bf;
	--scrollbar-track-color: #e8e6e1;

	/* Highlight */
	--highlight-color: #fafaf8;
	--yellow-highlight-color: #fdfaed;
	--placeholder-color: #f8f7f4;

	/* Shadows warm-tinted from --shadow-color: #1a1f2e */
	--shadow-xs: 0px 1px 2px 0px rgba(26, 31, 46, 0.04);
	--shadow-sm: 0px 1px 2px 0px rgba(26, 31, 46, 0.04), 0px 1px 2px -1px rgba(26, 31, 46, 0.04);
	--shadow-md: 0px 1px 2px 0px rgba(26, 31, 46, 0.04), 0px 2px 4px -1px rgba(26, 31, 46, 0.04);
	--card-shadow: var(--shadow-sm);
	--btn-shadow: var(--shadow-xs);
	--modal-shadow: var(--shadow-md);

	/* Surfaces (espresso) */
	--surface-gray-1: #fafaf8;
	--surface-gray-2: #f8f7f4;
	--surface-gray-3: #e8e6e1;
	--surface-gray-4: #dddbd4;

	/* Ink (espresso) */
	--ink-gray-1: #e8e6e1;
	--ink-gray-2: #dddbd4;
	--ink-gray-3: #d4d1bf;
	--ink-gray-4: #8b8e84;
	--ink-gray-5: #6b7280;
	--ink-gray-6: #4b5563;
	--ink-gray-7: #4b5563;
	--ink-gray-8: #2d3340;
	--ink-gray-9: #1a1f2e;

	/* Outline (espresso) */
	--outline-gray-1: #e8e6e1;
	--outline-gray-2: #dddbd4;
	--outline-gray-3: #d4d1bf;
	--outline-gray-4: #8b8e84;
	--outline-gray-5: #e8e6e1;
	--outline-gray-modals: #e8e6e1;

	/* Code block */
	--code-block-bg: #1a1f2e;
	--code-block-text: #d4d1bf;
}

[data-theme="dark"] {
	/* Dark gray scale */
	--neutral-white: #0a0a0a;
	--neutral-black: #f5f5f5;
	--neutral: #0f0f0f;
	--invert-neutral: #f5f5f5;

	/* --primary → #d4d1bf (inverted) */
	--primary: #d4d1bf;
	--primary-color: #d4d1bf;
	--brand-color: #d4d1bf;
	--btn-primary: #d4d1bf;
	--border-primary: #d4d1bf;
	--checkbox-color: #d4d1bf;
	--checkbox-gradient: linear-gradient(180deg, #d4d1bf, #d4d1bf);

	/* --background → #0a0a0a */
	--bg-color: #0a0a0a;

	/* --card → #121212 */
	--fg-color: #121212;
	--card-bg: #121212;

	/* --popover → #121212 */
	--popover-bg: #121212;
	--modal-bg: #121212;
	--toast-bg: #121212;
	--surface-modal: #121212;
	--surface-white: #0a0a0a;
	--surface-cards: #121212;

	/* --sidebar → #0f0f0f */
	--navbar-bg: #0f0f0f;
	--surface-menu-bar: #0f0f0f;

	/* --foreground → #f5f5f5 */
	--heading-color: #f5f5f5;
	--text-color: #f5f5f5;
	--text-neutral: #f5f5f5;
	--text-dark: #121212;
	--icon-stroke: #f5f5f5;

	/* --muted-foreground → #a0a0a0 */
	--text-muted: #a0a0a0;
	--text-light: #a0a0a0;
	--disabled-text-color: #6b7280;

	/* --muted / --secondary → #1a1a1a */
	--control-bg: #1a1a1a;
	--control-bg-on-gray: #2a2a2a;
	--subtle-fg: #1a1a1a;
	--subtle-accent: #0f0f0f;
	--disabled-control-bg: #1a1a1a;
	--input-disabled-bg: #1a1a1a;
	--awesomebar-focus-bg: #121212;
	--awesomplete-hover-bg: #1a1a1a;

	/* --accent → #36443a */
	--fg-hover-color: #1a1a1a;
	--sidebar-select-color: #1a1a1a;
	--surface-selected: #36443a;
	--switch-bg: #36443a;

	/* --border → #2a2a2a */
	--border-color: #2a2a2a;
	--dark-border-color: #363636;
	--table-border-color: #2a2a2a;
	--btn-group-border-color: #363636;
	--shadow-inset: inset 0px -1px 0px #2a2a2a;

	/* --secondary → #1a1a1a (default button bg) */
	--btn-default-bg: #1a1a1a;
	--btn-default-hover-bg: #2a2a2a;

	/* --input → #121212 */

	/* --destructive → #ef4444 */
	--danger: #ef4444;

	/* --ring → #7c9082 */
	--checkbox-focus-shadow: 0 0 0 2px #7c9082;
	--highlight-shadow: 1px 1px 10px rgba(124, 144, 130, 0.1), 0 0 4px rgba(124, 144, 130, 0.3);

	/* Scrollbar */
	--scrollbar-thumb-color: #363636;
	--scrollbar-track-color: #1a1a1a;

	/* Highlight */
	--highlight-color: #1a1a1a;
	--placeholder-color: #1a1a1a;

	/* Shadows */
	--shadow-xs: 0px 1px 2px 0px rgba(0, 0, 0, 0.04);
	--shadow-sm: 0px 1px 2px 0px rgba(0, 0, 0, 0.04), 0px 1px 2px -1px rgba(0, 0, 0, 0.04);
	--shadow-md: 0px 1px 2px 0px rgba(0, 0, 0, 0.04), 0px 2px 4px -1px rgba(0, 0, 0, 0.04);

	/* Surfaces (espresso) */
	--surface-gray-1: #1a1a1a;
	--surface-gray-2: #1f1f1f;
	--surface-gray-3: #2a2a2a;
	--surface-gray-4: #363636;
	--surface-gray-5: #a0a0a0;
	--surface-gray-6: #d4d4d4;
	--surface-gray-7: #f5f5f5;

	/* Ink (espresso) */
	--ink-gray-1: #1a1a1a;
	--ink-gray-2: #363636;
	--ink-gray-3: #6b7280;
	--ink-gray-4: #6b7280;
	--ink-gray-5: #808080;
	--ink-gray-6: #a0a0a0;
	--ink-gray-7: #b0b0b0;
	--ink-gray-8: #d4d4d4;
	--ink-gray-9: #f5f5f5;

	/* Outline (espresso) */
	--outline-white: #121212;
	--outline-gray-1: #1a1a1a;
	--outline-gray-2: #2a2a2a;
	--outline-gray-3: #363636;
	--outline-gray-4: #808080;
	--outline-gray-modals: #2a2a2a;

	/* Code block */
	--code-block-bg: #121212;
	--code-block-text: #d4d1bf;
}

/* Primary button text: white on dark sage, black on beige */
.btn-primary,
.btn-primary-dark {
	color: #ffffff !important;
}
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-primary-dark {
	color: #000000 !important;
}

/* Focus ring accent */
*:focus-visible {
	outline-color: #7c9082 !important;
}

/* Hide Help section in sidebar */
.sidebar-menu [data-name="help"] {
	display: none !important;
}

.sidebar-header-menu [data-name="help"] {
	display: none !important;
}

/* Login page: show logo only, hide heading text */
.for-login .page-card-head h4 {
	display: none !important;
}

/* Desk layout: remove white content patches behind pages/workspaces */
.desk-container,
.desk-page,
.desk-page .layout-main-section-wrapper,
.desk-page .layout-main-section,
.workspace-body,
.workspace .layout-main-section-wrapper,
.workspace .layout-main-section {
	background: var(--bg-color) !important;
}

/* Full white->theme replacement across desk */
body,
.desk-container,
.desk-page,
.desk-page .page-container,
.desk-page .main-section,
.layout-main,
.layout-main-section-wrapper,
.layout-main-section,
.standard-sidebar,
.workspace,
.workspace-body,
.page-body,
.page-content,
.report-wrapper,
.frappe-control,
.form-page,
.list-page,
.kanban-board,
.dashboard-view,
.widget-group,
.widget,
.widget-control,
.modal-content,
.popover,
.dropdown-menu {
	background-color: var(--bg-color) !important;
}

/* Keep cards and data surfaces readable but non-white patched */
.card,
.shadow-card,
.page-card,
.list-row,
.list-row-container,
.result,
.report-summary,
.number-card,
.dashboard-graph,
.form-layout,
.section-body,
.grid-body,
.form-grid {
	background-color: var(--card-bg) !important;
}

/* Strict fallback overrides for hardcoded inline white/black backgrounds */
:root {
	--mythril-light-surface: var(--bg-color);
	--mythril-dark-secondary-surface: #1a1a1a;
}

[data-theme="light"] [style*="background:#fff"],
[data-theme="light"] [style*="background: #fff"],
[data-theme="light"] [style*="background-color:#fff"],
[data-theme="light"] [style*="background-color: #fff"],
[data-theme="light"] [style*="background:#ffffff"],
[data-theme="light"] [style*="background: #ffffff"],
[data-theme="light"] [style*="background-color:#ffffff"],
[data-theme="light"] [style*="background-color: #ffffff"],
[data-theme="light"] [style*="background:rgb(255,255,255)"],
[data-theme="light"] [style*="background: rgb(255, 255, 255)"],
[data-theme="light"] [style*="background-color:rgb(255,255,255)"],
[data-theme="light"] [style*="background-color: rgb(255, 255, 255)"] {
	background-color: var(--mythril-light-surface) !important;
}

[data-theme="dark"] [style*="background:#000"],
[data-theme="dark"] [style*="background: #000"],
[data-theme="dark"] [style*="background-color:#000"],
[data-theme="dark"] [style*="background-color: #000"],
[data-theme="dark"] [style*="background:#000000"],
[data-theme="dark"] [style*="background: #000000"],
[data-theme="dark"] [style*="background-color:#000000"],
[data-theme="dark"] [style*="background-color: #000000"],
[data-theme="dark"] [style*="background:rgb(0,0,0)"],
[data-theme="dark"] [style*="background: rgb(0, 0, 0)"],
[data-theme="dark"] [style*="background-color:rgb(0,0,0)"],
[data-theme="dark"] [style*="background-color: rgb(0, 0, 0)"] {
	background-color: var(--mythril-dark-secondary-surface) !important;
}
