/* TreFinance Brand System: semantic tokens. Financial formatting lives in Laravel. */
:root {
    --tf-brand-primary: #0f6b4f;
    --tf-brand-dark: #0d3b2e;
    --tf-action: #075c46;
    --tf-action-text: #ffffff;
    --tf-accent: #10b981;
    --tf-growth: #22c55e;
    --tf-bg: #eef3f2;
    --tf-surface: #ffffff;
    --tf-surface-elevated: #ffffff;
    --tf-surface-muted: #f4f7f6;
    --tf-glass-surface: rgb(255 255 255 / .8);
    --tf-text-primary: #162b25;
    --tf-text-secondary: #526960;
    --tf-border: #d7e1df;
    --tf-control-border: #71867d;
    --tf-success: #116448;
    --tf-danger: #b42332;
    --tf-warning: #8b5300;
    --tf-info: #2463b5;
    --tf-investment: #6850a1;
    --tf-selected: #e7f8f0;
    --tf-focus: #146ad1;
    --tf-shadow-card: 0 1px 2px rgb(13 40 32 / .04), 0 4px 12px rgb(13 40 32 / .035);
    --tf-shadow-float: 0 12px 32px rgb(13 40 32 / .13);
    --tf-shadow-hover: 0 5px 16px rgb(13 40 32 / .08);
    --tf-light: rgb(255 255 255 / .56);
    --tf-edge: inset 0 1px 0 rgb(255 255 255 / .72);
    --tf-radius-card: 18px;
    --tf-radius-control: 12px;
    --tf-radius-small: 8px;
    --tf-font-ui: Inter, 'Noto Sans Bengali', system-ui, sans-serif;
    --tf-font-bangla: 'Noto Sans Bengali', Inter, system-ui, sans-serif;
    --tf-font-body: 15px;
    --tf-font-label: max(13px, .9em);
    --tf-font-caption: max(12px, .82em);
    --tf-font-section: clamp(17px, 1.5vw, 20px);
    --tf-font-page: clamp(24px, 2.2vw, 30px);
    --tf-space-1: 4px;
    --tf-space-2: 8px;
    --tf-space-3: 12px;
    --tf-space-4: 16px;
    --tf-space-5: 20px;
    --tf-space-6: 24px;
    --tf-space-8: 32px;
    --tf-control-size: 44px;
    --tf-icon-size: 20px;
    --tf-card-padding: clamp(var(--tf-space-4), 2vw, var(--tf-space-6));
    --tf-blur: 12px;
    --tf-duration-fast: 120ms;
    --tf-duration: 180ms;
    --tf-duration-sheet: 220ms;
    --tf-ease: cubic-bezier(.2, .7, .3, 1);
    --tf-z-header: 20;
    --tf-z-navigation: 100;
    --tf-z-overlay: 110;
    --tf-z-dialog: 200;
    --tf-z-toast: 300;
    --tf-chart-income: #0f6b4f;
    --tf-chart-expense: #b42332;
    --tf-chart-net: #2463b5;
    --tf-chart-fill: rgb(16 185 129 / .09);
}
html[data-theme="dark"] {
    color-scheme: dark;
    --tf-bg: #101a19;
    --tf-surface: #172622;
    --tf-surface-elevated: #20332e;
    --tf-surface-muted: #1c2d29;
    --tf-glass-surface: rgb(23 38 34 / .86);
    --tf-text-primary: #ecf8f2;
    --tf-text-secondary: #b8ccc2;
    --tf-border: #324843;
    --tf-control-border: #719f8c;
    --tf-action: #79e0b6;
    --tf-action-text: #0d3b2e;
    --tf-success: #7cecc2;
    --tf-danger: #ff9aa4;
    --tf-warning: #ffc46e;
    --tf-info: #9bc8ff;
    --tf-investment: #cebfff;
    --tf-selected: #1b4133;
    --tf-focus: #a6ccff;
    --tf-shadow-card: 0 6px 24px rgb(0 0 0 / .1);
    --tf-shadow-float: 0 14px 40px rgb(0 0 0 / .3);
    --tf-shadow-hover: 0 12px 30px rgb(0 0 0 / .22);
    --tf-light: rgb(236 248 242 / .12);
    --tf-edge: inset 0 1px 0 rgb(236 248 242 / .1);
    --tf-chart-income: #79e0b6;
    --tf-chart-expense: #ff9aa4;
    --tf-chart-net: #9bc8ff;
}
html[data-theme="light"] { color-scheme: light; }
/* Compatibility aliases keep every established module on the same palette. */
html[data-theme] {
    --bg: var(--tf-bg);
    --bg-secondary: var(--tf-surface-muted);
    --surface: var(--tf-surface);
    --surface-strong: var(--tf-surface-muted);
    --surface-hover: var(--tf-selected);
    --text: var(--tf-text-primary);
    --text-primary: var(--tf-text-primary);
    --text-secondary: var(--tf-text-secondary);
    --text-tertiary: var(--tf-text-secondary);
    --border: var(--tf-border);
    --border-strong: var(--tf-control-border);
    --mint: var(--tf-success);
    --mint-soft: var(--tf-selected);
    --purple: var(--tf-investment);
    --purple-2: var(--tf-investment);
    --purple-soft: var(--tf-surface-muted);
    --danger: var(--tf-danger);
    --danger-soft: color-mix(in srgb, var(--tf-danger) 9%, var(--tf-surface));
    --warning: var(--tf-warning);
    --blue: var(--tf-info);
    --input: var(--tf-surface);
    --sidebar: var(--tf-glass-surface);
    --option-bg: var(--tf-surface);
    --option-text: var(--tf-text-primary);
    --money-in: var(--tf-success);
    --money-out: var(--tf-danger);
    --money-transfer: var(--tf-info);
    --money-investment: var(--tf-investment);
    --shadow: var(--tf-shadow-card);
    --radius-xl: var(--tf-radius-card);
    --radius-lg: var(--tf-radius-card);
    --radius-md: var(--tf-radius-control);
    --ease: var(--tf-ease);
}
body[data-accent="mint"] { --mint: var(--tf-success); --mint-soft: var(--tf-selected); }
body[data-accent="blue"] { --mint: var(--tf-info); }
body[data-accent="violet"] { --mint: var(--tf-investment); }
body[data-accent="amber"] { --mint: var(--tf-warning); }
body[data-accent]:not([data-accent="mint"]) { --mint-soft: color-mix(in srgb, var(--mint) 10%, var(--tf-surface)); }
body[data-glass-blur="soft"] { --tf-blur: 8px; }
body[data-glass-blur="strong"] { --tf-blur: 16px; }
body.rounded-soft { --tf-radius-card: 12px; --tf-radius-control: 10px; }
body.square-cards { --tf-radius-card: 0px; }
body.text-large { --tf-font-body: 17px; }
body.text-small { --tf-font-body: 14px; }
html[data-theme] body.high-contrast {
    --tf-control-border: currentColor;
    --border: var(--tf-control-border);
    --tf-shadow-card: none;
    --tf-shadow-hover: none;
    --tf-glass-surface: var(--tf-surface);
}

/* Accent controls actions; financial income/expense colours remain semantic. */
body[data-accent="blue"] { --tf-action: #205aa6; --tf-action-text: #ffffff; }
body[data-accent="violet"] { --tf-action: #63439e; --tf-action-text: #ffffff; }
body[data-accent="amber"] { --tf-action: #855000; --tf-action-text: #ffffff; }
html[data-theme="dark"] body[data-accent="blue"] { --tf-action: #9bc8ff; --tf-action-text: #12243b; }
html[data-theme="dark"] body[data-accent="violet"] { --tf-action: #cebfff; --tf-action-text: #261847; }
html[data-theme="dark"] body[data-accent="amber"] { --tf-action: #ffc46e; --tf-action-text: #3c2608; }
body.high-contrast { --tf-surface: #ffffff; --tf-surface-muted: #f0f4f2; --tf-text-primary: #061710; --tf-text-secondary: #263e33; --tf-border: #52695d; --tf-control-border: #52695d; }
html[data-theme="dark"] body.high-contrast { --tf-surface: #081810; --tf-surface-muted: #10291d; --tf-text-primary: #ffffff; --tf-text-secondary: #d9f0e2; --tf-border: #9bb9a8; --tf-control-border: #9bb9a8; }

/* Resolve compatibility aliases in the same scope as the chosen accent. */
html[data-theme] body[data-accent] {
    --tf-accent:var(--tf-action); --mint:var(--tf-action);
    --tf-selected:color-mix(in srgb,var(--tf-action) 14%,var(--tf-surface));
    --mint-soft:var(--tf-selected); --surface-hover:var(--tf-selected);
    --purple:var(--tf-action); --purple-2:var(--tf-action);
    --border:var(--tf-border); --text:var(--tf-text-primary);
}

/* Light and dark optical material palettes. */
body {
    --liquid-shadow: rgb(13 40 32 / .13);
    --liquid-dialog: rgb(249 252 251 / .98);
    --liquid-input: rgb(255 255 255 / 1);
    --liquid-reflection: var(--tf-edge);
    --liquid-backdrop: linear-gradient(130deg, #e4ede9, transparent 62%);
}
html[data-theme="dark"] body {
    --liquid-shadow: rgb(0 8 7 / .35);
    --liquid-dialog: rgb(28 45 41 / .98);
    --liquid-input: rgb(23 38 34 / 1);
    --liquid-backdrop: linear-gradient(130deg, #1b302a, transparent 62%);
}
html body:not(.edge-shine) { --liquid-reflection: inset 0 0 0 transparent; }

body[data-shadow-intensity="soft"] {
    --tf-shadow-card: 0 4px 12px -8px var(--liquid-shadow);
    --tf-shadow-float: 0 8px 22px -10px var(--liquid-shadow);
    --tf-shadow-hover: var(--tf-shadow-float);
}
body[data-shadow-intensity="none"] {
    --tf-shadow-card: 0 0 0 transparent;
    --tf-shadow-float: 0 0 0 transparent;
    --tf-shadow-hover: 0 0 0 transparent;
}
