/*
 * Design tokens — Medusa UI (the look of Medusa Cloud / Medusa Admin, light mode).
 * Values are Medusa's own (--bg-subtle, --fg-muted, --buttons-neutral, --borders-base, --tag-*, ...),
 * exposed under the names the components already use. Components read these, never raw hex.
 */
:root {
    /* surfaces */
    --background: #ffffff;          /* bg-base */
    --subtle: #fafafa;              /* bg-subtle: sidebar, table header, page canvas */
    --bg-field: #fafafa;            /* bg-field */
    --bg-field-hover: #f4f4f5;
    --card: #ffffff;
    --popover: #ffffff;
    --muted: #f4f4f5;               /* bg-component-hover / tag-neutral-bg */
    --heading: #ebebeb;             /* page heading bar */
    /* order status label colors (report) */
    --status-with-florist: #7c3aed;
    --status-ready: #0d9488;
    --status-processing: #d97706;
    --status-in-transit: #2563eb;
    --status-delivered: #059669;
    --status-unknown: #71717a;
    --accent: #f4f4f5;              /* bg-base-hover */
    --secondary: #f4f4f5;
    --secondary-hover: #e4e4e7;     /* bg-base-pressed */
    --highlight: #eff6ff;           /* bg-highlight */
    --highlight-hover: #dbeafe;

    /* text */
    --foreground: #18181b;          /* fg-base */
    --card-foreground: #18181b;
    --popover-foreground: #18181b;
    --accent-foreground: #18181b;
    --secondary-foreground: #18181b;
    --text-secondary: #52525b;      /* fg-subtle */
    --muted-foreground: #71717a;    /* fg-muted */
    --fg-disabled: #a1a1aa;

    /* borders: Medusa draws most edges with a 1px shadow ring, these are for dividers */
    --border: #e4e4e7;              /* border-base */
    --border-strong: #d4d4d8;
    --input: transparent;

    /* primary = Medusa "inverted" button */
    --primary: #27272a;
    --primary-foreground: #ffffff;
    --primary-hover: #3f3f46;
    --primary-active: #52525b;
    --primary-soft: #eff6ff;
    --primary-soft-hover: #dbeafe;

    /* interactive (links, focus, selection) */
    --ring: #3b82f6;
    --link: #3b82f6;
    --link-hover: #2563eb;

    /* semantic */
    --button-danger: #e11d48;
    --button-danger-hover: #be123c;
    --button-success: #059669;
    --button-success-hover: #047857;
    --destructive: #e11d48;         /* fg-error: text and icons */
    --destructive-hover: #be123c;
    --destructive-soft: #ffe4e6;    /* tag-red-bg */
    --destructive-soft-hover: #fecdd3;
    --destructive-border: #fecdd3;
    --destructive-text: #9f1239;
    --success: #059669;
    --success-hover: #047857;
    --success-soft: #d1fae5;        /* tag-green-bg */
    --success-soft-hover: #a7f3d0;
    --success-border: #a7f3d0;
    --success-text: #065f46;
    --success-icon: #10b981;
    --info: #3b82f6;
    --info-hover: #2563eb;
    --info-soft: #dbeafe;           /* tag-blue-bg */
    --info-soft-hover: #bfdbfe;
    --info-border: #bfdbfe;
    --info-text: #1e40af;
    --warning: #f97316;
    --warning-foreground: #9a3412;  /* tag-orange-text */
    --warning-soft: #ffedd5;
    --warning-border: #fed7aa;
    --neutral-tag-text: #52525b;

    /* sidebar */
    --sidebar: #ffffff;
    --sidebar-foreground: #52525b;
    --sidebar-primary: #18181b;
    --sidebar-accent: #f4f4f5;
    --sidebar-accent-foreground: #18181b;
    --sidebar-active: #f4f4f5;
    --sidebar-active-foreground: #18181b;
    --sidebar-border: #e4e4e7;

    --radius: 6px;
    --radius-sm: 4px;
    --radius-lg: 8px;

    /* Medusa shadows */
    --shadow-buttons-neutral: 0 1px 2px 0 rgb(0 0 0 / 0.12), 0 0 0 1px rgb(0 0 0 / 0.08);
    --shadow-buttons-inverted: inset 0 0.75px 0 0 rgb(255 255 255 / 0.2), 0 1px 2px 0 rgb(0 0 0 / 0.4), 0 0 0 1px #18181b;
    --shadow-buttons-danger: inset 0 0.75px 0 0 rgb(255 255 255 / 0.2), 0 1px 2px 0 rgb(190 18 60 / 0.4), 0 0 0 1px #be123c;
    --shadow-buttons-success: inset 0 0.75px 0 0 rgb(255 255 255 / 0.2), 0 1px 2px 0 rgb(4 120 87 / 0.4), 0 0 0 1px #047857;
    --shadow-field: 0 1px 2px 0 rgb(0 0 0 / 0.12), 0 0 0 1px rgb(0 0 0 / 0.08);          /* borders-base */
    --focus-field: 0 0 0 4px rgb(37 99 235 / 0.2), 0 0 0 1px #2563eb;                    /* borders-interactive-with-active */
    --focus-ring: 0 0 0 1px #fff, 0 0 0 3px rgb(59 130 246 / 0.6);                       /* borders-focus */
    --shadow-card: 0 0 0 1px rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.08), 0 2px 4px 0 rgb(0 0 0 / 0.04);
    --shadow-flyout: 0 0 0 1px rgb(0 0 0 / 0.08), 0 4px 8px 0 rgb(0 0 0 / 0.08), 0 8px 16px 0 rgb(0 0 0 / 0.08);
    --shadow-modal: inset 0 0 0 1px #fff, inset 0 0 0 1.5px rgb(228 228 231 / 0.6), 0 0 0 1px rgb(0 0 0 / 0.08), 0 8px 16px 0 rgb(0 0 0 / 0.08), 0 16px 32px 0 rgb(0 0 0 / 0.08);
    /* old names used by components */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.04);
    --shadow-sm: 0 1px 2px -1px rgb(0 0 0 / 0.08), 0 2px 4px 0 rgb(0 0 0 / 0.04);
    --shadow-md: 0 4px 8px 0 rgb(0 0 0 / 0.08), 0 8px 16px 0 rgb(0 0 0 / 0.08);
    --shadow-lg: 0 8px 16px 0 rgb(0 0 0 / 0.08), 0 16px 32px 0 rgb(0 0 0 / 0.08);
    --overlay: rgb(24 24 27 / 0.4);

    /* business signals: order row attention/flags, sort/filter header (light = historical colors) */
    --row-complaint: #dad2e9;
    --row-other: #d9ead2;
    --row-problem: #e7b8b0;
    --row-update: #fff3cd;
    --row-urgent: #fde5cd;
    --row-red-flag: #ff9292;
    --row-yellow-flag: #fffec2;
    --row-warn-flag: #d0e1f5;
    --th-sorted: #fde68a;
    --th-filtered: #d9f99d;
    --warm-soft: #fff8e1;           /* "current period" cells, locked cells */

    --chart-text: #71717a;
    --chart-grid: #e4e4e7;

    color-scheme: light;

    --ease: cubic-bezier(0.2, 0, 0, 1);
    --duration: 150ms;

    /* legacy names, mapped onto the tokens above */
    --color-background-default: var(--sidebar);
    --color-background-light: var(--subtle);
    --color-bg-primary: var(--primary);
    --color-bg-hilight: var(--accent);
    --color-text-fade: var(--muted-foreground);
}

/*
 * Dark mode — Medusa UI dark tokens (@medusajs/ui-preset). Set by the theme switcher in the user menu
 * (html[data-theme="dark"]). Business-signal colors keep their hue, tinted onto the dark base.
 */
:root[data-theme="dark"] {
    color-scheme: dark;

    --background: #212124;          /* bg-base */
    --subtle: #18181b;              /* bg-subtle */
    --bg-field: rgb(255 255 255 / 0.04);
    --bg-field-hover: rgb(255 255 255 / 0.08);
    --card: #212124;
    --popover: #27272a;
    --muted: #27272a;               /* bg-component */
    --heading: #27272a;             /* page heading bar */
    --status-with-florist: #a78bfa;
    --status-ready: #2dd4bf;
    --status-processing: #fbbf24;
    --status-in-transit: #60a5fa;
    --status-delivered: #34d399;
    --status-unknown: #a1a1aa;
    --accent: #27272a;              /* bg-base-hover */
    --secondary: #27272a;
    --secondary-hover: #3f3f46;     /* bg-base-pressed */
    --highlight: #172554;
    --highlight-hover: #1e3a8a;

    --foreground: #f4f4f5;          /* fg-base */
    --card-foreground: #f4f4f5;
    --popover-foreground: #f4f4f5;
    --accent-foreground: #f4f4f5;
    --secondary-foreground: #f4f4f5;
    --text-secondary: #a1a1aa;      /* fg-subtle */
    --muted-foreground: #8b8b94;    /* fg-muted, lifted from #71717a for 4.5:1 on #212124 */
    --fg-disabled: #52525b;

    --border: rgb(255 255 255 / 0.08);
    --border-strong: rgb(255 255 255 / 0.16);

    --primary: #52525b;             /* button-inverted */
    --primary-foreground: #ffffff;
    --primary-hover: #71717a;
    --primary-active: #a1a1aa;
    --primary-soft: #172554;
    --primary-soft-hover: #1e3a8a;

    --ring: #60a5fa;
    --link: #60a5fa;                /* fg-interactive */
    --link-hover: #93c5fd;

    --button-danger: #9f1239;
    --button-danger-hover: #be123c;
    --button-success: #047857;
    --button-success-hover: #059669;
    --destructive: #fb7185;         /* fg-error */
    --destructive-hover: #fda4af;
    --destructive-soft: #4c0519;    /* tag-red-bg */
    --destructive-soft-hover: #881337;
    --destructive-border: #881337;
    --destructive-text: #fda4af;
    --success: #34d399;
    --success-hover: #6ee7b7;
    --success-soft: #022c22;
    --success-soft-hover: #064e3b;
    --success-border: #064e3b;
    --success-text: #34d399;
    --success-icon: #10b981;
    --info: #60a5fa;
    --info-hover: #93c5fd;
    --info-soft: #172554;
    --info-soft-hover: #1e3a8a;
    --info-border: #1e3a8a;
    --info-text: #93c5fd;
    --warning: #fb923c;
    --warning-foreground: #fdba74;
    --warning-soft: #431407;
    --warning-border: #7c2d12;
    --neutral-tag-text: #d4d4d8;

    --sidebar: #18181b;
    --sidebar-foreground: #a1a1aa;
    --sidebar-primary: #f4f4f5;
    --sidebar-accent: #27272a;
    --sidebar-accent-foreground: #f4f4f5;
    --sidebar-active: #212124;
    --sidebar-active-foreground: #f4f4f5;
    --sidebar-border: rgb(255 255 255 / 0.08);

    --shadow-buttons-neutral: 0 -1px 0 0 rgb(255 255 255 / 0.06), 0 0 0 1px rgb(255 255 255 / 0.06), 0 0 0 1px #27272a, 0 0 1px 1.5px rgb(0 0 0 / 0.24), 0 2px 2px 0 rgb(0 0 0 / 0.24);
    --shadow-buttons-inverted: 0 -1px 0 0 rgb(255 255 255 / 0.12), 0 0 0 1px rgb(255 255 255 / 0.1), 0 0 0 1px #52525b, 0 0 1px 1.5px rgb(0 0 0 / 0.24), 0 2px 2px 0 rgb(0 0 0 / 0.24);
    --shadow-buttons-danger: 0 -1px 0 0 rgb(255 255 255 / 0.16), 0 0 0 1px rgb(255 255 255 / 0.12), 0 0 0 1px #9f1239, 0 0 1px 1.5px rgb(0 0 0 / 0.24), 0 2px 2px 0 rgb(0 0 0 / 0.24);
    --shadow-buttons-success: 0 -1px 0 0 rgb(255 255 255 / 0.16), 0 0 0 1px rgb(255 255 255 / 0.12), 0 0 0 1px #047857, 0 0 1px 1.5px rgb(0 0 0 / 0.24), 0 2px 2px 0 rgb(0 0 0 / 0.24);
    --shadow-field: 0 -1px 0 0 rgb(255 255 255 / 0.06), 0 0 0 1px rgb(255 255 255 / 0.06), 0 0 0 1px #27272a, 0 0 1px 1.5px rgb(0 0 0 / 0.24), 0 2px 2px 0 rgb(0 0 0 / 0.24);
    --focus-field: 0 0 0 1px #60a5fa, 0 0 0 4px rgb(59 130 246 / 0.25);
    --focus-ring: 0 0 0 1px #18181b, 0 0 0 3px rgb(96 165 250 / 0.8);
    --shadow-card: 0 -1px 0 0 rgb(255 255 255 / 0.06), 0 0 0 1px rgb(255 255 255 / 0.06), 0 0 0 1px #27272a, 0 1px 2px 0 rgb(0 0 0 / 0.32), 0 2px 4px 0 rgb(0 0 0 / 0.32);
    --shadow-flyout: 0 -1px 0 0 rgb(255 255 255 / 0.04), 0 0 0 1px rgb(255 255 255 / 0.1), 0 4px 8px 0 rgb(0 0 0 / 0.32), 0 8px 16px 0 rgb(0 0 0 / 0.32);
    --shadow-modal: inset 0 0 0 1px #18181b, inset 0 0 0 1.5px rgb(255 255 255 / 0.06), 0 -1px 0 0 rgb(255 255 255 / 0.04), 0 0 0 1px rgb(255 255 255 / 0.1), 0 4px 8px 0 rgb(0 0 0 / 0.32), 0 8px 16px 0 rgb(0 0 0 / 0.32);
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.32);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.32), 0 2px 4px 0 rgb(0 0 0 / 0.32);
    --shadow-md: 0 4px 8px 0 rgb(0 0 0 / 0.32), 0 8px 16px 0 rgb(0 0 0 / 0.32);
    --shadow-lg: 0 4px 8px 0 rgb(0 0 0 / 0.32), 0 8px 16px 0 rgb(0 0 0 / 0.32);
    --overlay: rgb(24 24 27 / 0.72);

    --row-complaint: #473f60;
    --row-other: #284335;
    --row-problem: #663b3d;
    --row-update: #484021;
    --row-urgent: #553c2a;
    --row-red-flag: #802e3e;
    --row-yellow-flag: #3b3622;
    --row-warn-flag: #2f3e53;
    --th-sorted: #6b4d1b;
    --th-filtered: #3f5420;
    --warm-soft: #3f3220;

    --chart-text: #a1a1aa;
    --chart-grid: rgb(255 255 255 / 0.08);
}
