/* =====================================================================
   PressAI — SYSTEM SKÓREK (THEMES)
   ---------------------------------------------------------------------
   Dostępne motywy:
   1. Ciemny motyw (dark)       — Głęboka czerń i ciemny grafit z energetycznym żółtym akcentem
   2. Nordycki chłód (nordic)   — Chłodna stalowoszara tonacja z lodowym błękitem
   3. Papier redakcyjny (paper) — Ciepły, jasny motyw czytelniczy z atramentem i szkarłatem
   4. Tech-Room (techroom)      — Stylistyka tech-room.pl: ciemny glassmorphism, granat i neonowy cyjan
   ===================================================================== */

/* =====================================================================
   1. CIEMNY MOTYW (dark / cyberpunk) — Czarno-grafitowe tło + neonowy żółty akcent
   ===================================================================== */
html[data-theme="dark"],
html[data-theme="cyberpunk"] {
    color-scheme: dark;

    /* Ton neutralny: głęboka czerń i elegancki grafit */
    --tone-neutral-50:  #f8fafc;
    --tone-neutral-100: #edf0f4;
    --tone-neutral-200: #d4d9e2;
    --tone-neutral-300: #b0b8c9;
    --tone-neutral-400: #828da4;
    --tone-neutral-500: #525c74;
    --tone-neutral-600: #333a4c;
    --tone-neutral-700: #222735;
    --tone-neutral-800: #161922;
    --tone-neutral-900: #0b0c10;
    --tone-neutral-950: #050608;

    /* Akcent: żywy, energetyczny cyberpunkowy żółty / złoty */
    --tone-brand-50:  #fefce8;
    --tone-brand-100: #fef9c3;
    --tone-brand-200: #fef08a;
    --tone-brand-300: #fde047;
    --tone-brand-400: #facc15;
    --tone-brand-500: #eab308;
    --tone-brand-600: #ca8a04;
    --tone-brand-700: #a16207;
    --tone-brand-800: #854d0e;
    --tone-brand-900: #713f12;
    --tone-brand-950: #422006;

    --c-white: #ffffff;
    --c-black: #000000;

    --bg-dark: #0b0c10;
    --bg-header: rgba(14, 16, 22, 0.96);
    --bg-card: rgba(22, 25, 34, 0.72);
    --bg-card-header: rgba(28, 32, 44, 0.88);
    --bg-input: rgba(14, 16, 22, 0.92);
    --border-color: rgba(60, 68, 86, 0.65);
    --text-color: #f8fafc;
    --text-muted: #cbd5e1;
    --text-subtle: #828da4;
    --color-primary: #facc15;
    --color-primary-hover: #eab308;
    --color-primary-text: #fde047;
    --color-on-primary: #000000;
    --color-accent: #f59e0b;
    --color-card: rgba(22, 25, 34, 0.55);

    --link-color: #fde047;
    --link-hover: #fef08a;

    --email-text: #e2e8f0;
    --quote-bg: rgba(14, 16, 22, 0.8);
    --disclaimer-bg: rgba(5, 6, 8, 0.6);
    --disclaimer-border: #333a4c;

    --autofill-bg: #0b0c10;
    --checkbox-bg: #050608;
    --checkbox-border: #525c74;
    --focus-glow: rgba(250, 204, 21, 0.45);
    --focus-glow-soft: rgba(250, 204, 21, 0.2);

    --scrollbar-track: rgba(14, 16, 22, 0.6);
    --scrollbar-thumb: rgba(51, 58, 76, 0.85);
    --scrollbar-thumb-hover: rgba(82, 92, 116, 1);

    --preview-bg: #ffffff;
    --preview-heading: #0b0c10;
    --preview-text: #161922;
    --preview-link: #ca8a04;
    --preview-link-hover: #a16207;
    --preview-caption: #525c74;

    accent-color: #facc15;
    caret-color: #fde047;
}

html[data-theme="dark"] .btn-primary,
html[data-theme="cyberpunk"] .btn-primary {
    background-color: #facc15 !important;
    color: #000000 !important;
    border-color: #eab308 !important;
    font-weight: 600;
    box-shadow: 0 0 14px rgba(250, 204, 21, 0.35);
}
html[data-theme="dark"] .btn-primary:hover,
html[data-theme="cyberpunk"] .btn-primary:hover {
    background-color: #eab308 !important;
    color: #000000 !important;
    border-color: #ca8a04 !important;
    box-shadow: 0 0 20px rgba(250, 204, 21, 0.55);
}
html[data-theme="dark"] .btn-primary svg,
html[data-theme="cyberpunk"] .btn-primary svg {
    color: #000000 !important;
}


/* =====================================================================
   2. NORDYCKI CHŁÓD (nordic) — Chłodna stalowoszara tonacja z lodowym błękitem
   ===================================================================== */
html[data-theme="nordic"] {
    color-scheme: dark;

    /* Chłodny arktyczny błękit/stal (hue ~215-225) */
    --tone-neutral-50:  #f0f4f8;
    --tone-neutral-100: #d9e2ec;
    --tone-neutral-200: #bcccdc;
    --tone-neutral-300: #9fb3c8;
    --tone-neutral-400: #829ab1;
    --tone-neutral-500: #627d98;
    --tone-neutral-600: #486581;
    --tone-neutral-700: #334e68;
    --tone-neutral-800: #1f3448;
    --tone-neutral-900: #102131;
    --tone-neutral-950: #09131d;

    /* Akcent lodowy błękit (cyan/ice) */
    --tone-brand-50:  #e0f7fa;
    --tone-brand-100: #b2ebf2;
    --tone-brand-200: #80deea;
    --tone-brand-300: #4dd0e1;
    --tone-brand-400: #26c6da;
    --tone-brand-500: #00bcd4;
    --tone-brand-600: #00acc1;
    --tone-brand-700: #0097a7;
    --tone-brand-800: #00838f;
    --tone-brand-900: #006064;
    --tone-brand-950: #00363a;

    --c-white: #ffffff;
    --c-black: #000000;

    --bg-dark: #0c1724;
    --bg-header: rgba(14, 28, 44, 0.95);
    --bg-card: rgba(26, 47, 71, 0.55);
    --bg-card-header: rgba(26, 47, 71, 0.75);
    --bg-input: rgba(12, 23, 36, 0.9);
    --border-color: rgba(68, 103, 138, 0.5);
    --text-color: #f0f4f8;
    --text-muted: #9fb3c8;
    --text-subtle: #627d98;
    --color-primary: #38bdf8;
    --color-primary-hover: #0ea5e9;
    --color-primary-text: #38bdf8;
    --color-on-primary: #041f31;
    --color-accent: #00bcd4;
    --color-card: rgba(26, 47, 71, 0.4);

    --link-color: #38bdf8;
    --link-hover: #7dd3fc;

    --email-text: #e0f2fe;
    --quote-bg: rgba(16, 33, 49, 0.75);
    --disclaimer-bg: rgba(9, 19, 29, 0.6);
    --disclaimer-border: #334e68;

    --autofill-bg: #102131;
    --checkbox-bg: #09131d;
    --checkbox-border: #486581;
    --focus-glow: rgba(56, 189, 248, 0.4);
    --focus-glow-soft: rgba(56, 189, 248, 0.2);

    --scrollbar-track: rgba(16, 33, 49, 0.6);
    --scrollbar-thumb: rgba(72, 101, 129, 0.8);
    --scrollbar-thumb-hover: rgba(98, 125, 152, 1);

    --preview-bg: #ffffff;
    --preview-heading: #0f172a;
    --preview-text: #1e293b;
    --preview-link: #0284c7;
    --preview-link-hover: #0369a1;
    --preview-caption: #627d98;

    accent-color: #38bdf8;
    caret-color: #38bdf8;
}


/* =====================================================================
   3. PAPIER REDAKCYJNY (paper) — Ciepły, jasny motyw czytelniczy z atramentem i szkarłatem
   ===================================================================== */
html[data-theme="paper"] {
    color-scheme: light;

    /* Odwrócony ton neutralny: jasny kremowy papier na dole, ciemny atrament na górze */
    --tone-neutral-50:  #1e293b;
    --tone-neutral-100: #334155;
    --tone-neutral-200: #475569;
    --tone-neutral-300: #64748b;
    --tone-neutral-400: #78716c;
    --tone-neutral-500: #a8a29e;
    --tone-neutral-600: #d6d3d1;
    --tone-neutral-700: #e7e5e4;
    --tone-neutral-800: #f5f5f4;
    --tone-neutral-900: #fafaf9;
    --tone-neutral-950: #fdfdfc;

    /* Akcent: elegancki szkarłat / burgundy dziennikarski */
    --tone-brand-50:  #450a0a;
    --tone-brand-100: #7f1d1d;
    --tone-brand-200: #991b1b;
    --tone-brand-300: #b91c1c;
    --tone-brand-400: #dc2626;
    --tone-brand-500: #b91c1c;
    --tone-brand-600: #ef4444;
    --tone-brand-700: #f87171;
    --tone-brand-800: #fecaca;
    --tone-brand-900: #fee2e2;
    --tone-brand-950: #fef2f2;

    /* Odwrócone tony semantyczne dla jasnego papieru — gwarantują wysoki kontrast badge'y i przycisków */
    --tone-danger-50:  #450a0a;
    --tone-danger-100: #7f1d1d;
    --tone-danger-200: #991b1b;
    --tone-danger-300: #991b1b;
    --tone-danger-400: #b91c1c;
    --tone-danger-500: #dc2626;
    --tone-danger-600: #dc2626;
    --tone-danger-700: #f87171;
    --tone-danger-800: #fca5a5;
    --tone-danger-900: #fee2e2;
    --tone-danger-950: #fef2f2;

    --tone-success-50:  #022c22;
    --tone-success-100: #064e3b;
    --tone-success-200: #065f46;
    --tone-success-300: #065f46;
    --tone-success-400: #047857;
    --tone-success-500: #059669;
    --tone-success-600: #059669;
    --tone-success-700: #34d399;
    --tone-success-800: #6ee7b7;
    --tone-success-900: #d1fae5;
    --tone-success-950: #ecfdf5;

    --tone-warning-50:  #451a03;
    --tone-warning-100: #78350f;
    --tone-warning-200: #92400e;
    --tone-warning-300: #92400e;
    --tone-warning-400: #b45309;
    --tone-warning-500: #d97706;
    --tone-warning-600: #d97706;
    --tone-warning-700: #fbbf24;
    --tone-warning-800: #fcd34d;
    --tone-warning-900: #fef3c7;
    --tone-warning-950: #fffbeb;

    --tone-info-50:  #082f49;
    --tone-info-100: #0c4a6e;
    --tone-info-200: #075985;
    --tone-info-300: #0369a1;
    --tone-info-400: #0284c7;
    --tone-info-500: #0ea5e9;
    --tone-info-600: #0284c7;
    --tone-info-700: #38bdf8;
    --tone-info-800: #7dd3fc;
    --tone-info-900: #e0f2fe;
    --tone-info-950: #f0f9ff;

    --c-white: #1c1917; /* tekst pierwotnie "biały" w nagłówkach staje się ciemny */
    --c-black: #fafaf9;

    --bg-dark: #f8f6f0;
    --bg-header: rgba(244, 241, 234, 0.96);
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-header: rgba(246, 243, 237, 0.95);
    --bg-input: #ffffff;
    --border-color: rgba(214, 207, 196, 0.85);
    --text-color: #1c1917;
    --text-muted: #57534e;
    --text-subtle: #78716c;
    --color-primary: #b91c1c;
    --color-primary-hover: #991b1b;
    --color-primary-text: #b91c1c;
    --color-on-primary: #ffffff;
    --color-accent: #c2410c;
    --color-card: rgba(255, 255, 255, 0.8);

    --link-color: #b91c1c;
    --link-hover: #991b1b;

    --email-text: #292524;
    --quote-bg: rgba(244, 241, 234, 0.9);
    --disclaimer-bg: rgba(238, 234, 225, 0.8);
    --disclaimer-border: #d6cfc4;

    --autofill-bg: #fafaf9;
    --checkbox-bg: #ffffff;
    --checkbox-border: #a8a29e;
    --focus-glow: rgba(185, 28, 28, 0.3);
    --focus-glow-soft: rgba(185, 28, 28, 0.15);

    --scrollbar-track: #f4f1ea;
    --scrollbar-thumb: #d6cfc4;
    --scrollbar-thumb-hover: #a8a29e;

    --body-pattern: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2240%22%20height%3D%2240%22%3E%3Ccircle%20cx%3D%221%22%20cy%3D%221%22%20r%3D%221%22%20fill%3D%22rgba(0%2C0%2C0%2C0.03)%22%2F%3E%3C%2Fsvg%3E");

    --preview-bg: #ffffff;
    --preview-heading: #1c1917;
    --preview-text: #292524;
    --preview-link: #b91c1c;
    --preview-link-hover: #991b1b;
    --preview-caption: #78716c;

    accent-color: #b91c1c;
    caret-color: #b91c1c;
}

html[data-theme="paper"] header h1 span {
    background: none !important;
    -webkit-text-fill-color: #1c1917 !important;
    color: #1c1917 !important;
}
html[data-theme="paper"] .btn-primary {
    color: #ffffff !important;
}


/* =====================================================================
   Kafelki wyboru skórki (Ustawienia → Wygląd)
   ===================================================================== */
.skin-option {
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.skin-option:hover {
    border-color: var(--color-primary-text) !important;
}
.skin-option:active {
    transform: scale(0.99);
}
.skin-option.active-skin,
.skin-option:has(input:checked) {
    border-color: var(--color-primary) !important;
    background-color: var(--color-card) !important;
    box-shadow: 0 0 0 2px var(--color-primary), 0 0 18px var(--focus-glow) !important;
}
.skin-option:focus-visible,
.skin-option:has(input:focus-visible) {
    outline: 2px solid var(--color-primary-text);
    outline-offset: 2px;
}
.skin-swatch {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 6px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.skin-swatch span {
    width: 10px;
    height: 10px;
    border-radius: 9999px;
    display: inline-block;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Dostosowania dla motywu jasnego (Paper) */
html[data-theme="paper"] .skin-option {
    background-color: #ffffff !important;
    border-color: rgba(214, 207, 196, 0.9) !important;
}
html[data-theme="paper"] .skin-option:hover {
    background-color: #fafaf9 !important;
    border-color: #b91c1c !important;
}
html[data-theme="paper"] .skin-option.active-skin,
html[data-theme="paper"] .skin-option:has(input:checked) {
    background-color: #fef2f2 !important;
    border-color: #b91c1c !important;
}
html[data-theme="paper"] .skin-option .text-slate-100 {
    color: #1c1917 !important;
}
html[data-theme="paper"] .skin-option .text-slate-400 {
    color: #57534e !important;
}
html[data-theme="paper"] .skin-swatch {
    background: #e7e5e4 !important;
    border-color: #d6d3d1 !important;
}

/* =====================================================================
   UNIFIKACJA KONTRASTU PRZYCISKÓW I ZAKŁADEK WE WSZYSTKICH SKÓRKACH
   ===================================================================== */

/* Aktywne zakładki folderów poczty i trybu edytora — czytelny tekst na kolorze primary */
#mail-folder-tab-inbox[aria-selected="true"],
#mail-folder-tab-sent[aria-selected="true"],
#mail-folder-tab-trash[aria-selected="true"] {
    background-color: var(--color-primary) !important;
    color: var(--color-on-primary) !important;
}
#mail-folder-tab-inbox[aria-selected="true"] span[id^="tab-badge-"],
#mail-folder-tab-sent[aria-selected="true"] span[id^="tab-badge-"],
#mail-folder-tab-trash[aria-selected="true"] span[id^="tab-badge-"] {
    background-color: rgba(0, 0, 0, 0.28) !important;
    color: #ffffff !important;
}

/* Pełny kontrast wszystkich wariantów przycisków w jasnej skórce Editorial Paper */
html[data-theme="paper"] .btn-primary {
    background-color: #b91c1c !important;
    color: #ffffff !important;
    border-color: #991b1b !important;
    box-shadow: 0 1px 3px rgba(185, 28, 28, 0.25) !important;
}
html[data-theme="paper"] .btn-primary:hover {
    background-color: #991b1b !important;
    color: #ffffff !important;
    border-color: #7f1d1d !important;
}
html[data-theme="paper"] .btn-primary svg {
    color: #ffffff !important;
}

html[data-theme="paper"] .btn-secondary {
    background-color: #ece7dc !important;
    color: #1c1917 !important;
    border-color: #c7bfb0 !important;
    box-shadow: 0 1px 2px rgba(28, 25, 23, 0.06) !important;
}
html[data-theme="paper"] .btn-secondary:hover {
    background-color: #dfd8c8 !important;
    color: #0c0a09 !important;
    border-color: #a89f8e !important;
}

html[data-theme="paper"] .btn-danger {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
    border-color: #f87171 !important;
    box-shadow: 0 1px 2px rgba(153, 27, 27, 0.08) !important;
}
html[data-theme="paper"] .btn-danger:hover {
    background-color: #fecaca !important;
    color: #7f1d1d !important;
    border-color: #ef4444 !important;
}
html[data-theme="paper"] .btn-danger svg {
    color: #991b1b !important;
}

html[data-theme="paper"] .btn-danger-solid {
    background-color: #dc2626 !important;
    color: #ffffff !important;
    border-color: #b91c1c !important;
}
html[data-theme="paper"] .btn-danger-solid:hover {
    background-color: #b91c1c !important;
    color: #ffffff !important;
}
html[data-theme="paper"] .btn-danger-solid svg {
    color: #ffffff !important;
}

html[data-theme="paper"] .btn-success {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    border-color: #34d399 !important;
    box-shadow: 0 1px 2px rgba(6, 95, 70, 0.08) !important;
}
html[data-theme="paper"] .btn-success:hover {
    background-color: #a7f3d0 !important;
    color: #064e3b !important;
    border-color: #10b981 !important;
}
html[data-theme="paper"] .btn-success svg {
    color: #065f46 !important;
}

html[data-theme="paper"] .btn-success-solid {
    background-color: #047857 !important;
    color: #ffffff !important;
    border-color: #065f46 !important;
    box-shadow: 0 1px 3px rgba(4, 120, 87, 0.25) !important;
}
html[data-theme="paper"] .btn-success-solid:hover {
    background-color: #065f46 !important;
    color: #ffffff !important;
}
html[data-theme="paper"] .btn-success-solid svg {
    color: #ffffff !important;
}

html[data-theme="paper"] .btn-warning {
    background-color: #d97706 !important;
    color: #ffffff !important;
    border-color: #b45309 !important;
}
html[data-theme="paper"] .btn-warning:hover {
    background-color: #b45309 !important;
    color: #ffffff !important;
}
html[data-theme="paper"] .btn-warning svg {
    color: #ffffff !important;
}

html[data-theme="paper"] .btn-ai {
    background-color: #7e22ce !important;
    color: #ffffff !important;
    border-color: #6b21a8 !important;
    box-shadow: 0 1px 3px rgba(126, 34, 206, 0.25) !important;
}
html[data-theme="paper"] .btn-ai:hover {
    background-color: #6b21a8 !important;
    color: #ffffff !important;
}
html[data-theme="paper"] .btn-ai svg {
    color: #ffffff !important;
}

/* Zakładki nieaktywne i powiadomienia w motywie Paper */
html[data-theme="paper"] #mail-folder-tab-inbox[aria-selected="false"],
html[data-theme="paper"] #mail-folder-tab-sent[aria-selected="false"],
html[data-theme="paper"] #mail-folder-tab-trash[aria-selected="false"] {
    color: #44403c !important;
}
html[data-theme="paper"] #mail-folder-tab-inbox[aria-selected="false"]:hover,
html[data-theme="paper"] #mail-folder-tab-sent[aria-selected="false"]:hover,
html[data-theme="paper"] #mail-folder-tab-trash[aria-selected="false"]:hover {
    background-color: #ece7dc !important;
    color: #1c1917 !important;
}
html[data-theme="paper"] #mail-folder-tab-inbox[aria-selected="false"] span[id^="tab-badge-"],
html[data-theme="paper"] #mail-folder-tab-sent[aria-selected="false"] span[id^="tab-badge-"],
html[data-theme="paper"] #mail-folder-tab-trash[aria-selected="false"] span[id^="tab-badge-"] {
    background-color: #e2dcd0 !important;
    color: #292524 !important;
}
html[data-theme="paper"] #toast {
    color: #ffffff !important;
}


/* =====================================================================
   ZWIJANE SEKCJE W USTAWIENIACH (dla wszystkich motywów)
   ===================================================================== */
.settings-section-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.settings-section-header:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
}
html[data-theme="paper"] .settings-section-header:hover {
    background-color: rgba(28, 25, 23, 0.04) !important;
}
.settings-chevron {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--text-subtle);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease;
}
.settings-section-header:hover .settings-chevron {
    color: var(--color-primary-text);
}
.settings-section.is-collapsed .settings-chevron {
    transform: rotate(-90deg);
}
.settings-section.is-collapsed .settings-section-header {
    border-bottom-color: transparent !important;
}
.settings-section.is-collapsed .settings-section-body {
    display: none !important;
}


/* =====================================================================
   4. TECH-ROOM (techroom) — Czysty, wysokokontrastowy panel administracyjny
      1 krój (Manrope), 3 ciemne tony (#0B0F19 / #121A2B / #1A253D),
      1 główny akcent (#00E5FF), zero zbędnych gradientów i neonów.
   ===================================================================== */
html[data-theme="techroom"] {
    color-scheme: dark;

    /* Spójna, surowa paleta granatowo-ciemna (wysoki kontrast) */
    --tone-neutral-50:  #FFFFFF;
    --tone-neutral-100: #E6EDF7;
    --tone-neutral-200: #D0DCEB;
    --tone-neutral-300: #B4C4DA;
    --tone-neutral-400: #94A6C2;
    --tone-neutral-500: #6E82A1;
    --tone-neutral-600: #3A4B6B;
    --tone-neutral-700: #24314D;
    --tone-neutral-800: #162036;
    --tone-neutral-900: #121A2B;
    --tone-neutral-950: #0B0F19;

    /* Jeden spójny akcent: Cyjan Tech-Room */
    --tone-brand-50:  #E6FCFF;
    --tone-brand-100: #BDF6FF;
    --tone-brand-200: #80EEFF;
    --tone-brand-300: #3DE9FF;
    --tone-brand-400: #00E5FF;
    --tone-brand-500: #00C8E0;
    --tone-brand-600: #00A6BD;
    --tone-brand-700: #0F6C80;
    --tone-brand-800: #12485C;
    --tone-brand-900: #0E2F42;
    --tone-brand-950: #0A1D2B;

    /* Stonowane, czytelne kolory statusów (bez krzykliwości) */
    --tone-warning-400: #F3C85A;
    --tone-warning-500: #E0B240;
    --tone-danger-400:  #F87171;
    --tone-danger-500:  #EF4444;
    --tone-success-400: #4ADE80;
    --tone-success-500: #22C55E;
    --tone-info-400:    #00E5FF;
    --tone-info-500:    #00C8E0;

    --c-white: #FFFFFF;
    --c-black: #0B0F19;

    /* Główne zmienne aplikacji */
    --bg-dark: #0B0F19;
    --bg-header: #0E1424;
    --bg-card: #121A2B;
    --bg-card-header: #0E1525;
    --bg-input: #0B101C;
    --border-color: #24314D;
    --text-color: #FFFFFF;
    --text-muted: #D8E2F0;
    --text-subtle: #94A6C2;
    --color-primary: #00E5FF;
    --color-primary-hover: #33ECFF;
    --color-primary-text: #00E5FF;
    --color-on-primary: #0B0F19;
    --color-accent: #00E5FF;
    --color-card: #162036;

    --link-color: #00E5FF;
    --link-hover: #7CF3FF;

    --email-text: #E6EDF7;
    --quote-bg: #0E1525;
    --disclaimer-bg: #0B101C;
    --disclaimer-border: #24314D;

    --autofill-bg: #0B101C;
    --checkbox-bg: #0B101C;
    --checkbox-border: #4A5F85;
    --focus-glow: rgba(0, 229, 255, 0.35);
    --focus-glow-soft: rgba(0, 229, 255, 0.14);

    --scrollbar-track: #0B0F19;
    --scrollbar-thumb: #24314D;
    --scrollbar-thumb-hover: #3A4B6B;

    /* Jednolite, spokojne tło bez wzorów i gradientów */
    --body-pattern: none;

    --preview-bg: #ffffff;
    --preview-heading: #0B0F19;
    --preview-text: #1E293B;
    --preview-link: #0284C7;
    --preview-link-hover: #0369A1;
    --preview-caption: #526680;

    accent-color: #00E5FF;
    caret-color: #00E5FF;
}

/* Jeden krój pisma (Manrope) w całym panelu — zero mieszania fontów */
html[data-theme="techroom"],
html[data-theme="techroom"] body,
html[data-theme="techroom"] h1,
html[data-theme="techroom"] h2,
html[data-theme="techroom"] h3,
html[data-theme="techroom"] .font-display,
html[data-theme="techroom"] button,
html[data-theme="techroom"] input,
html[data-theme="techroom"] select,
html[data-theme="techroom"] textarea {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

html[data-theme="techroom"] body {
    background-color: #0B0F19 !important;
    background-image: none !important;
    color: #FFFFFF !important;
    -webkit-font-smoothing: antialiased;
}

/* Czysty, płaski topbar */
html[data-theme="techroom"] header {
    background-color: #0E1424 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: 1px solid #24314D !important;
    box-shadow: none !important;
}

/* Uproszczona hierarchia nagłówków (tylko 2 poziomy: widok + karta, bez uppercase) */
html[data-theme="techroom"] #view-settings h2,
html[data-theme="techroom"] #view-inbox h2,
html[data-theme="techroom"] #view-rss h2,
html[data-theme="techroom"] #view-drafts h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em;
    color: #FFFFFF !important;
}
html[data-theme="techroom"] #view-settings h2::before,
html[data-theme="techroom"] #view-inbox h2::before,
html[data-theme="techroom"] #view-rss h2::before,
html[data-theme="techroom"] #view-drafts h2::before {
    content: "";
    width: 3px;
    height: 20px;
    border-radius: 2px;
    background: #00E5FF;
    flex-shrink: 0;
}

/* Solidne, wyraźne karty (wysoki kontrast, zero blura i ciężkich cieni) */
html[data-theme="techroom"] .card,
html[data-theme="techroom"] details.card,
html[data-theme="techroom"] .accordion {
    background-color: #121A2B !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid #24314D !important;
    border-radius: 10px !important;
    box-shadow: none !important;
}

html[data-theme="techroom"] .settings-section-header {
    background-color: #0E1525 !important;
    border-bottom: 1px solid #24314D !important;
}
html[data-theme="techroom"] .settings-section-header h3 {
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    color: #FFFFFF !important;
}
html[data-theme="techroom"] .settings-section-header h3 svg {
    color: #00E5FF !important;
}

/* Proste, płaskie przyciski administracyjne o wysokim kontraście */
html[data-theme="techroom"] .btn {
    border-radius: 8px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    box-shadow: none !important;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease !important;
}
html[data-theme="techroom"] .btn-primary {
    background-color: #00E5FF !important;
    border: 1px solid #00E5FF !important;
    color: #0B0F19 !important;
}
html[data-theme="techroom"] .btn-primary:hover {
    background-color: #4DEBFF !important;
    border-color: #4DEBFF !important;
    color: #0B0F19 !important;
}
html[data-theme="techroom"] .btn-primary svg {
    color: #0B0F19 !important;
}

html[data-theme="techroom"] .btn-secondary {
    background-color: #1A253D !important;
    border: 1px solid #2F4063 !important;
    color: #FFFFFF !important;
}
html[data-theme="techroom"] .btn-secondary:hover {
    background-color: #223150 !important;
    border-color: #00E5FF !important;
    color: #FFFFFF !important;
}

html[data-theme="techroom"] .btn-danger {
    background-color: #2A1620 !important;
    border: 1px solid #7F1D3A !important;
    color: #FDA4AF !important;
}
html[data-theme="techroom"] .btn-danger:hover {
    background-color: #E11D48 !important;
    border-color: #E11D48 !important;
    color: #FFFFFF !important;
}

html[data-theme="techroom"] .btn-success,
html[data-theme="techroom"] .btn-success-solid {
    background-color: #15803D !important;
    border: 1px solid #16A34A !important;
    color: #FFFFFF !important;
}
html[data-theme="techroom"] .btn-warning {
    background-color: #F3C85A !important;
    border: 1px solid #F3C85A !important;
    color: #0B0F19 !important;
}
html[data-theme="techroom"] .btn-ai {
    background-color: #00E5FF !important;
    border: 1px solid #00E5FF !important;
    color: #0B0F19 !important;
}
html[data-theme="techroom"] .btn-ai:hover {
    background-color: #4DEBFF !important;
    border-color: #4DEBFF !important;
}

/* Zakładki folderów poczty — prosty, czytelny stan aktywny */
html[data-theme="techroom"] #mail-folder-tab-inbox,
html[data-theme="techroom"] #mail-folder-tab-sent,
html[data-theme="techroom"] #mail-folder-tab-trash {
    border-radius: 8px !important;
    border: 1px solid #24314D !important;
    background-color: #121A2B !important;
    color: #D8E2F0 !important;
    box-shadow: none !important;
}
html[data-theme="techroom"] #mail-folder-tab-inbox:hover,
html[data-theme="techroom"] #mail-folder-tab-sent:hover,
html[data-theme="techroom"] #mail-folder-tab-trash:hover {
    border-color: #3A4B6B !important;
    color: #FFFFFF !important;
}
html[data-theme="techroom"] #mail-folder-tab-inbox[aria-selected="true"],
html[data-theme="techroom"] #mail-folder-tab-sent[aria-selected="true"],
html[data-theme="techroom"] #mail-folder-tab-trash[aria-selected="true"] {
    background-color: #00E5FF !important;
    border-color: #00E5FF !important;
    color: #0B0F19 !important;
    font-weight: 700 !important;
}
html[data-theme="techroom"] #mail-folder-tab-inbox[aria-selected="true"] span[id^="tab-badge-"],
html[data-theme="techroom"] #mail-folder-tab-sent[aria-selected="true"] span[id^="tab-badge-"],
html[data-theme="techroom"] #mail-folder-tab-trash[aria-selected="true"] span[id^="tab-badge-"] {
    background-color: rgba(11, 15, 25, 0.2) !important;
    color: #0B0F19 !important;
}

/* Pola formularzy — ostre, wysokokontrastowe */
html[data-theme="techroom"] .input,
html[data-theme="techroom"] .textarea,
html[data-theme="techroom"] .select {
    background-color: #0B101C !important;
    border: 1px solid #2B3B5E !important;
    border-radius: 8px !important;
    color: #FFFFFF !important;
    font-size: 0.875rem !important;
    box-shadow: none !important;
}
html[data-theme="techroom"] .input::placeholder,
html[data-theme="techroom"] .textarea::placeholder {
    color: #6E82A1 !important;
}
html[data-theme="techroom"] .input:focus,
html[data-theme="techroom"] .textarea:focus,
html[data-theme="techroom"] .select:focus {
    border-color: #00E5FF !important;
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.2) !important;
}

/* Wiersze list (Poczta, RSS, Prompty) */
html[data-theme="techroom"] #inbox-list > div,
html[data-theme="techroom"] #rss-articles-list > div,
html[data-theme="techroom"] #settings-prompts-list > button {
    background-color: #121A2B !important;
    border: 1px solid #24314D !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}
html[data-theme="techroom"] #inbox-list > div:hover,
html[data-theme="techroom"] #rss-articles-list > div:hover,
html[data-theme="techroom"] #settings-prompts-list > button:hover {
    background-color: #162036 !important;
    border-color: #00E5FF !important;
}

/* Modale */
html[data-theme="techroom"] [id$="-modal"] > div {
    background-color: #121A2B !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid #2F4063 !important;
    border-radius: 10px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6) !important;
}

/* Kafelek aktywnej skórki */
html[data-theme="techroom"] .skin-option {
    background-color: #0E1525 !important;
    border: 1px solid #24314D !important;
    border-radius: 8px !important;
}
html[data-theme="techroom"] .skin-option.active-skin,
html[data-theme="techroom"] .skin-option:has(input:checked) {
    border-color: #00E5FF !important;
    background-color: #162036 !important;
    box-shadow: 0 0 0 1px #00E5FF !important;
}

/* Wyraźny focus ring (dostępność) */
html[data-theme="techroom"] :focus-visible {
    outline: 2px solid #00E5FF !important;
    outline-offset: 2px;
}


/* =====================================================================
   FLOATING RAMKA AKTYWNYCH PROCESÓW (#process-dock) — wszystkie motywy
   ===================================================================== */
#process-dock {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 9000;
    min-width: 220px;
    max-width: 310px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    font-size: 12px;
    line-height: 1.35;
    color: var(--text-color);
}
html[data-theme="techroom"] #process-dock {
    background-color: #121A2B;
    border-color: #2B3B5E;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}
html[data-theme="paper"] #process-dock {
    background-color: #ffffff;
    border-color: #d6cfc4;
    box-shadow: 0 8px 24px rgba(28, 25, 23, 0.12);
}

.process-dock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    background-color: var(--bg-card-header);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}
#process-dock.is-collapsed .process-dock-header {
    border-bottom-color: transparent;
}
#process-dock.is-collapsed .process-dock-list {
    display: none;
}
.process-dock-pulse {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background-color: var(--color-primary-text);
    flex-shrink: 0;
    animation: processDockPulse 1.4s ease-in-out infinite;
}
#process-dock.is-idle-done .process-dock-pulse {
    background-color: #22c55e;
    animation: none;
}
@keyframes processDockPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.82); }
}
.process-dock-toggle {
    background: transparent;
    border: none;
    color: var(--text-subtle);
    font-size: 14px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
}
.process-dock-toggle:hover {
    color: var(--text-color);
}
.process-dock-list {
    display: flex;
    flex-direction: column;
    max-height: 180px;
    overflow-y: auto;
}
.process-dock-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s ease;
}
.process-dock-item:last-child {
    border-bottom: none;
}
.process-dock-item.is-clickable {
    cursor: pointer;
}
.process-dock-item.is-clickable:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
html[data-theme="paper"] .process-dock-item.is-clickable:hover {
    background-color: rgba(28, 25, 23, 0.04);
}
.process-dock-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--border-color);
    border-top-color: var(--color-primary-text);
    border-radius: 999px;
    flex-shrink: 0;
    animation: processDockSpin 0.8s linear infinite;
}
@keyframes processDockSpin {
    to { transform: rotate(360deg); }
}
.process-dock-status-ok {
    color: #22c55e;
    font-weight: 700;
    font-size: 12px;
    width: 12px;
    text-align: center;
    flex-shrink: 0;
}
.process-dock-status-err {
    color: #f43f5e;
    font-weight: 700;
    font-size: 12px;
    width: 12px;
    text-align: center;
    flex-shrink: 0;
}
.process-dock-text {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.process-dock-subject {
    font-weight: 600;
    color: var(--text-color);
}
.process-dock-action {
    color: var(--text-muted);
}
