:root {
    --lg-brand:        #2563eb;
    --lg-brand-dark:   #1d4ed8;
    --lg-brand-light:  #dbeafe;
    --lg-brand-shadow: rgba(37, 99, 235, 0.35);
    --lg-bg:           #ffffff;
    --lg-surface:      #f8f9fa;
    --lg-surface-2:    #eef0f2;
    --lg-border:       #e5e7eb;
    --lg-text-1:       #111827;
    --lg-text-2:       #6b7280;
    --lg-text-3:       #9ca3af;
    --lg-success:      #16a34a;
    --lg-danger:       #dc2626;
    --lg-danger-light: #fee2e2;

    /* Shape/elevation scale — same numeric values as Project Memory's
       theme-clean.css tokens, so the two apps share one shape language. */
    --lg-radius-small:  10px;
    --lg-radius-medium: 18px;
    --lg-radius-large:  26px;
    --lg-radius-full:   999px;
    --lg-shadow-small:  0 1px 4px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --lg-shadow-large:  0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.10);
    --lg-overlay-dark-mid: rgba(0, 0, 0, 0.75);
    --lg-z-modal: 700;
}

@media (prefers-color-scheme: dark) {
    :root {
        --lg-bg:           #111827;
        --lg-surface:      #1f2937;
        --lg-surface-2:    #29303e;
        --lg-border:       #374151;
        --lg-text-1:       #f9fafb;
        --lg-text-2:       #9ca3af;
        --lg-text-3:       #6b7280;
        --lg-brand-light:  #1e3a5f;
        --lg-danger-light: #4c1d1d;
    }
}

/* Manual theme override (Settings → Theme, 14 July 2026 — Rocky: his own phone follows the
   system Dark theme setting, but on an older Android 10 phone with Dark theme off he wants Digger
   to stay light regardless — and vice versa, force dark even if the phone itself is light). An
   attribute selector on :root has higher specificity than the plain `:root` inside the
   prefers-color-scheme media query above, so these always win once `data-theme` is set —
   `lgUtils.lgApplyTheme` sets/clears it on <html>. No attribute at all (the default, "System
   default" in the picker) falls straight through to the media query above, unchanged. */
:root[data-theme="light"] {
    --lg-bg:           #ffffff;
    --lg-surface:      #f8f9fa;
    --lg-surface-2:    #eef0f2;
    --lg-border:       #e5e7eb;
    --lg-text-1:       #111827;
    --lg-text-2:       #6b7280;
    --lg-text-3:       #9ca3af;
    --lg-brand-light:  #dbeafe;
    --lg-danger-light: #fee2e2;
}

:root[data-theme="dark"] {
    --lg-bg:           #111827;
    --lg-surface:      #1f2937;
    --lg-surface-2:    #29303e;
    --lg-border:       #374151;
    --lg-text-1:       #f9fafb;
    --lg-text-2:       #9ca3af;
    --lg-text-3:       #6b7280;
    --lg-brand-light:  #1e3a5f;
    --lg-danger-light: #4c1d1d;
}

/* Third manual theme, "Tan" (14 July 2026, Rocky: "midway... light tans and browns... going for
   a muted professional look"). Unlike the Light/Dark overrides above (which only swap the
   background/surface/text neutrals), Tan also warms up --lg-brand itself — a bright blue accent
   button would clash against a warm neutral palette, so every action button/link/selected-state
   color shifts to a muted coffee-brown too, for a genuinely cohesive look rather than a blue
   accent bolted onto tan backgrounds. --lg-success/--lg-danger deliberately stay their normal
   red/green (recognizability for status colors matters more than palette purity there), same as
   Light/Dark already do. */
:root[data-theme="tan"] {
    --lg-brand:        #8c5a2b;
    --lg-brand-dark:   #6e4520;
    --lg-brand-light:  #ecd9bc;
    --lg-brand-shadow: rgba(140, 90, 43, 0.35);
    --lg-bg:           #f7f2ea;
    --lg-surface:      #efe3d0;
    --lg-surface-2:    #e4d3b8;
    --lg-border:       #d3bd97;
    --lg-text-1:       #3d2b1a;
    --lg-text-2:       #7a5c3e;
    --lg-text-3:       #a68a63;
    --lg-danger-light: #f3ddd0;
}

/* Fourth/fifth manual themes, "Green" and "Blue" (14 July 2026, same session — Rocky: a "light
   green... natural look" and a blue theme "going for trustworthy, solid, professional"). Same
   approach as Tan: background/surface/border/text neutrals AND --lg-brand itself both shift, so
   each theme reads as one cohesive palette rather than the default blue accent sitting on top of
   different-colored neutrals. --lg-success/--lg-danger still stay their normal red/green in both. */
:root[data-theme="green"] {
    --lg-brand:        #4a7c3f;
    --lg-brand-dark:   #3a6231;
    --lg-brand-light:  #d7ead0;
    --lg-brand-shadow: rgba(74, 124, 63, 0.35);
    --lg-bg:           #f3f7ef;
    --lg-surface:      #e7f0e1;
    --lg-surface-2:    #d9e8d1;
    --lg-border:       #c1d9b6;
    --lg-text-1:       #22391f;
    --lg-text-2:       #5c7a56;
    --lg-text-3:       #8fa688;
    --lg-danger-light: #f4ded9;
}

:root[data-theme="blue"] {
    --lg-brand:        #1e4d8c;
    --lg-brand-dark:   #163c6e;
    --lg-brand-light:  #d3e3f7;
    --lg-brand-shadow: rgba(30, 77, 140, 0.35);
    --lg-bg:           #f2f6fb;
    --lg-surface:      #e6edf6;
    --lg-surface-2:    #d7e2f1;
    --lg-border:       #bccde3;
    --lg-text-1:       #112a4a;
    --lg-text-2:       #4a6484;
    --lg-text-3:       #8098b8;
    --lg-danger-light: #f6dfe1;
}
