/* ProcessFlow theme palettes. The picker previews use the same colors as the pages. */

body.pf-w005[data-pf-theme="light"],
.pf-theme-sample[data-pf-theme="light"] {
    --bg: #f4f4f1;
    --surface: #ffffff;
    --raised: #eeefea;
    --dialog: #fbfbf8;
    --line: #cccec7;
    --t1: #20221e;
    --t2: #444840;
    --t3: #5d6258;
    --accent: #437719;
    --tint: #e6f1dc;
    --pf-header: #151518;
    --pf-action: #7ddc1d;
}

body.pf-w005[data-pf-theme="sand"],
.pf-theme-sample[data-pf-theme="sand"] {
    --bg: #f6e8cf;
    --surface: #fff7e8;
    --raised: #efdfc1;
    --dialog: #fff5e2;
    --line: #cdb690;
    --t1: #382919;
    --t2: #5b4730;
    --t3: #6c553b;
    --accent: #874500;
    --tint: #f4debb;
    --pf-header: #33281e;
    --pf-action: #e7a855;
}

body.pf-w005[data-pf-theme="mint"],
.pf-theme-sample[data-pf-theme="mint"] {
    --bg: #e0f3e9;
    --surface: #f3fff8;
    --raised: #cde9dc;
    --dialog: #effcf5;
    --line: #a5c9b6;
    --t1: #19392e;
    --t2: #345748;
    --t3: #466556;
    --accent: #14664c;
    --tint: #d0eddf;
    --pf-header: #17372d;
    --pf-action: #78d8af;
}

body.pf-w005[data-pf-theme="sky"],
.pf-theme-sample[data-pf-theme="sky"] {
    --bg: #e1effc;
    --surface: #f5faff;
    --raised: #cddff2;
    --dialog: #f0f7ff;
    --line: #a3bfd9;
    --t1: #1c344d;
    --t2: #3a526b;
    --t3: #4b6178;
    --accent: #235e9a;
    --tint: #d7e8fb;
    --pf-header: #1b3047;
    --pf-action: #82bfff;
}

body.pf-w005[data-pf-theme="lavender"],
.pf-theme-sample[data-pf-theme="lavender"] {
    --bg: #eee5fa;
    --surface: #fbf8ff;
    --raised: #e4d8f0;
    --dialog: #f8f3ff;
    --line: #c4b2d7;
    --t1: #382844;
    --t2: #564267;
    --t3: #675474;
    --accent: #72448e;
    --tint: #ebdcf4;
    --pf-header: #35273e;
    --pf-action: #cba3eb;
}

body.pf-w005[data-pf-theme="dark"],
.pf-theme-sample[data-pf-theme="dark"] {
    --bg: #19191c;
    --surface: #232326;
    --raised: #2c2c30;
    --dialog: #242427;
    --line: #404044;
    --t1: #f6f5f3;
    --t2: #cfcecc;
    --t3: #aeadaa;
    --accent: #7ddc1d;
    --tint: #303c28;
    --pf-header: #151518;
    --pf-action: #7ddc1d;
}

body.pf-w005[data-pf-theme="navy"],
.pf-theme-sample[data-pf-theme="navy"] {
    --bg: #101d33;
    --surface: #192b47;
    --raised: #233957;
    --dialog: #1c304d;
    --line: #415779;
    --t1: #eff5ff;
    --t2: #cedbee;
    --t3: #a7bcd6;
    --accent: #8cbfff;
    --tint: #263e5c;
    --pf-header: #0b1728;
    --pf-action: #8cbfff;
}

body.pf-w005[data-pf-theme="forest"],
.pf-theme-sample[data-pf-theme="forest"] {
    --bg: #10271e;
    --surface: #19372a;
    --raised: #244735;
    --dialog: #1d3b2e;
    --line: #426550;
    --t1: #effbf1;
    --t2: #c9e4d2;
    --t3: #a7c7b4;
    --accent: #83dda0;
    --tint: #284a36;
    --pf-header: #0c1e16;
    --pf-action: #83dda0;
}

body.pf-w005[data-pf-theme="plum"],
.pf-theme-sample[data-pf-theme="plum"] {
    --bg: #2c1b32;
    --surface: #3b2643;
    --raised: #4a3153;
    --dialog: #402a48;
    --line: #72527b;
    --t1: #fcf1ff;
    --t2: #e7cfea;
    --t3: #c9abcd;
    --accent: #e3a3ee;
    --tint: #553459;
    --pf-header: #231429;
    --pf-action: #e3a3ee;
}

body.pf-w005[data-pf-theme="mocha"],
.pf-theme-sample[data-pf-theme="mocha"] {
    --bg: #30211c;
    --surface: #412e25;
    --raised: #50382d;
    --dialog: #453025;
    --line: #735647;
    --t1: #fbf1e8;
    --t2: #e8d4c2;
    --t3: #cab39f;
    --accent: #edb17e;
    --tint: #583c2a;
    --pf-header: #251913;
    --pf-action: #edb17e;
}

/* Keep the original white MOKADI artwork legible in every palette. */
body.pf-w005[data-pf-theme] .main-header {
    background: var(--pf-header);
    border-bottom-color: color-mix(in srgb, var(--pf-header) 78%, white);
}
body.pf-w005[data-pf-theme] .main-header :is(.back-button, .theme-toggle, .header-user) {
    background: color-mix(in srgb, var(--pf-header) 92%, white);
    border-color: color-mix(in srgb, var(--pf-header) 77%, white);
}
body.pf-w005[data-pf-theme] .main-header :is(.back-button, .theme-toggle, .logout-button):hover {
    background: color-mix(in srgb, var(--pf-header) 80%, white);
    border-color: color-mix(in srgb, var(--pf-header) 60%, white);
}
body.pf-w005[data-pf-theme] :is(.btn-save:not(#btnSaveNewVersion), .lock-unlock-btn, .btn-approve.not-signed) {
    background: var(--pf-action);
    color: #162017;
}
body.pf-w005[data-pf-theme] :is(.btn-save:not(#btnSaveNewVersion), .lock-unlock-btn, .btn-approve.not-signed):enabled:hover {
    background: color-mix(in srgb, var(--pf-action) 85%, white);
}

/* Category gradients are the original colors in the dark themes. */
body.pf-w005 :is(.cat-tile, .subcat-tile, .proc-tile) {
    color: #fff;
    --t3: #dedee4;
    --warn: #ffe1a3;
    --success: #8ce3bc;
    --surface: #302923;
    background: var(--tile-gradient);
    border-color: var(--tile-border);
    box-shadow: 0 3px 10px -5px var(--tile-shadow);
}
body.pf-w005 :is(button.cat-tile, button.subcat-tile, a.proc-tile):is(:hover, :focus-visible) {
    background: var(--tile-gradient);
    border-color: var(--tile-hover);
    box-shadow: 0 4px 16px -5px var(--tile-shadow), inset 0 0 0 1px var(--tile-hover);
}
body.pf-w005 :is(.cat-icon, .subcat-icon-wrap) {
    background: var(--tile-glow);
    color: #fff;
}
body.pf-w005 .proc-tile[aria-disabled] { color: #d5d4d9; }
/* Tint the actual category colors against the current light palette. The underlying
   surface also composites the alpha in CATEGORY_TREE's original border colors. */
body.pf-w005.light-theme :is(.cat-tile, .subcat-tile, .proc-tile) {
    --surface: inherit;
    --t3: inherit;
    --warn: inherit;
    --success: inherit;
    --pastel: linear-gradient(145deg,
        color-mix(in srgb, var(--tile-hover) 49%, white),
        color-mix(in srgb, var(--tile-border) 23%, var(--surface)));
    background: var(--pastel), var(--surface);
    color: var(--t1);
    border-color: color-mix(in srgb, var(--tile-hover) 48%, var(--line));
    box-shadow: 0 2px 6px rgb(26 31 42 / 7%);
}
body.pf-w005.light-theme :is(button.cat-tile, button.subcat-tile, a.proc-tile):is(:hover, :focus-visible) {
    background: var(--pastel), var(--surface);
    border-color: var(--tile-hover);
    box-shadow: inset 0 0 0 1px var(--tile-hover);
}
body.pf-w005.light-theme :is(.cat-icon, .subcat-icon-wrap) {
    color: color-mix(in srgb, var(--t1) 85%, var(--tile-hover));
    background: rgb(255 255 255 / 58%);
    border: 1px solid var(--tile-border);
}
body.pf-w005.light-theme .proc-tile[aria-disabled] { color: var(--t2); }
body.pf-w005 .header-brand { border-radius: 6px; text-decoration: none; }
body.pf-w005 .header-user #userAvatarImg { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
body.pf-w005[data-pf-theme] .header-user .pf-theme-trigger {
    width: 32px; min-height: 32px; height: 32px; padding: 0;
    border: 0; border-radius: 50%; background: transparent;
}
body.pf-w005 .header-user .user-info { min-width: 0; }
body.pf-w005 .pf-theme-dialog {
    position: fixed;
    inset: 0;
    width: min(480px, calc(100% - 24px));
    max-height: calc(100dvh - 24px);
    margin: auto;
    padding: 20px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--dialog);
    color: var(--t1);
    box-shadow: 0 20px 70px #0005;
}
.pf-theme-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.pf-theme-heading h2 { font-size: 1.22rem; line-height: 1.3; letter-spacing: -.02em; }
.pf-theme-heading button {
    width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); color: var(--t2); font-size: 21px; line-height: 1; cursor: pointer;
}
.pf-theme-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pf-theme-groups h3 { font-size: .83rem; color: var(--t2); margin-bottom: 8px; }
.pf-theme-choice {
    width: 100%; min-height: 44px; margin: 0 0 5px; padding: 7px 9px;
    display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); color: var(--t1); font: inherit; font-size: .88rem; text-align: left; cursor: pointer;
}
.pf-theme-choice:hover, .pf-theme-heading button:hover { background: var(--raised); }
.pf-theme-choice[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); }
.pf-theme-check { margin-left: auto; color: var(--accent); font-weight: 700; visibility: hidden; }
.pf-theme-choice[aria-pressed="true"] .pf-theme-check { visibility: visible; }
.pf-theme-sample {
    position: relative; width: 32px; height: 25px; flex: none; border: 1px solid var(--line); border-radius: 4px;
    background: linear-gradient(to bottom, var(--pf-header) 0 5px, var(--bg) 5px);
}
.pf-theme-sample::after {
    content: ''; position: absolute; inset: 9px 4px 4px;
    background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 2px;
}
@media (max-width: 760px) {
    body.pf-w005 .main-header { flex-wrap: wrap; }
    body.pf-w005 .header-user .user-info { display: flex; }
    body.pf-w005 .header-user .user-name { max-width: min(30vw, 140px); font-size: .78rem; }
    body.pf-w005 .header-actions { margin-left: auto; }
}
@media (max-width: 420px) {
    body.pf-w005 .pf-theme-dialog { padding: 14px; }
    .pf-theme-groups { gap: 9px; }
    .pf-theme-choice { gap: 6px; padding: 6px; }
    .pf-theme-sample { width: 23px; }
}
