/* PeekPilot theme toggle */
.theme-toggle {
    display:inline-flex;
    width:94px;
    height:34px;
    flex:0 0 94px;
    gap:2px;
    padding:3px;
    align-items:center;
    justify-content:center;
    border:1px solid #c7d2d9;
    border-radius:999px;
    background:#f1f5f9;
    color:#084c41;
    cursor:pointer;
    transition:background-color .18s ease,color .18s ease,border-color .18s ease,transform .18s ease;
}
.theme-toggle:hover { background:#e8f2e8; }
.theme-toggle:focus-visible { outline:3px solid rgba(8,76,65,.32); outline-offset:2px; }
.theme-toggle-option { display:flex; width:50%; height:100%; align-items:center; justify-content:center; border-radius:999px; color:#596760; font-size:11px; font-weight:600; line-height:1; }
.theme-toggle[aria-checked="false"] .theme-toggle-light,
.theme-toggle[aria-checked="true"] .theme-toggle-dark { background:#084c41; color:#fff; }
.footer-slogan-link { color:#084c41; font-weight:600; text-decoration:underline; text-underline-offset:3px; }
.footer-slogan-link:hover { color:#0d7560; }
.footer-slogan-link:focus-visible { outline:2px solid currentColor; outline-offset:3px; border-radius:2px; }

/* Dark palette and component overrides. Keep success/warning/error hues distinct. */
html.dark-mode {
    color-scheme:dark;
    --color-bg:#0d1512;
    --color-panel:#14201b;
    --color-panel-alt:#1b2b24;
    --color-line:#31443b;
    --color-text:#e8f0ec;
    --color-muted:#a4b4ac;
    --color-accent:#68c9a2;
    --color-accent-soft:rgba(104,201,162,.16);
    --color-success:#62d58f;
    --color-danger:#ff8585;
    background:#0d1512 !important;
    background-image:none !important;
}
html.dark-mode body { color:#e8f0ec; background:transparent; }
html.dark-mode .theme-toggle { border-color:#40564b; background:#101b16; color:#e8f0ec; }
html.dark-mode .theme-toggle:hover { border-color:#69c9a2; background:#101b16; }
html.dark-mode .theme-toggle:focus-visible { outline-color:rgba(104,201,162,.5); }
html.dark-mode .theme-toggle-option { color:#c6d2cc; }
html.dark-mode .theme-toggle[aria-checked="false"] .theme-toggle-light,
html.dark-mode .theme-toggle[aria-checked="true"] .theme-toggle-dark { background:#68c9a2; color:#09291f; }
html.dark-mode .footer-slogan-link { color:#9ee5bd; }
html.dark-mode .footer-slogan-link:hover { color:#d6f6e7; }
html.dark-mode .settings-tab:not([aria-selected="true"]) { border-color:#40564b; background:#14201b; color:#c6d2cc; }
html.dark-mode header img[src*="peekpilot-logo"] {
    filter:drop-shadow(0 0 1px #fff) drop-shadow(0 0 3px rgba(255,255,255,.82));
}
html.dark-mode footer [class~="hover:text-black"]:hover,
html.dark-mode footer .group:hover [class~="group-hover:text-black"] {
    color:#d6f6e7 !important;
}

/* Main surfaces */
html.dark-mode [class~="bg-white"],
html.dark-mode [class~="bg-[#fff]"],
html.dark-mode [class~="bg-[#f8f9ff]"],
html.dark-mode [class~="bg-[#f8faf9]"],
html.dark-mode [class~="bg-[#f7faf7]"],
html.dark-mode [class~="bg-[#edf3fe]"],
html.dark-mode [class~="bg-[#f5f8ff]"],
html.dark-mode [class~="bg-[#f1f5f9]"],
html.dark-mode [class~="bg-[#e8f2e8]"] {
    background-color:#14201b !important;
}
html.dark-mode [class~="bg-[#f0f5ee]"],
html.dark-mode [class~="bg-[#f8fafc]"],
html.dark-mode [class~="bg-[#f8fbf9]"],
html.dark-mode [class~="bg-[#f9fafb]"],
html.dark-mode [class~="bg-[#f3f8f5]"],
html.dark-mode [class~="bg-[#fbfdfb]"],
html.dark-mode [class~="bg-[#f0fdf4]"],
html.dark-mode [class~="bg-[#ecfdf5]"] {
    background-color:#1b2a23 !important;
}
html.dark-mode [class~="bg-[#fef2f2]"],
html.dark-mode [class~="bg-[#fee2e2]"],
html.dark-mode [class~="bg-[#fff1f2]"] { background-color:#32191b !important; }
html.dark-mode [class~="bg-[#fffbeb]"],
html.dark-mode [class~="bg-[#fef3c7]"] { background-color:#302713 !important; }
html.dark-mode [class~="bg-[#eff6ff]"],
html.dark-mode [class~="bg-[#dbeafe]"] { background-color:#17283a !important; }
html.dark-mode [class~="bg-[#084c41]"] { background-color:#0c4a3c !important; }
html.dark-mode [class~="bg-black/10"] { background-color:rgba(0,0,0,.16) !important; }
html.dark-mode [class~="bg-black/15"] { background-color:rgba(0,0,0,.22) !important; }
html.dark-mode [class~="bg-black/30"] { background-color:rgba(0,0,0,.32) !important; }

/* Text */
html.dark-mode [class~="text-black"],
html.dark-mode [class~="text-black/80"],
html.dark-mode [class~="text-black/70"],
html.dark-mode [class~="text-[#071611]"],
html.dark-mode [class~="text-[#111827]"],
html.dark-mode [class~="text-[#1f2937]"] { color:#e8f0ec !important; }
html.dark-mode [class~="text-[#54606b]"],
html.dark-mode [class~="text-[#59656f]"],
html.dark-mode [class~="text-[#596760]"],
html.dark-mode [class~="text-[#65707a]"],
html.dark-mode [class~="text-[#6a7674]"],
html.dark-mode [class~="text-[#2d3a45]"],
html.dark-mode [class~="text-[#475569]"] { color:#a9bbb1 !important; }
html.dark-mode [class~="text-[#084c41]"] { color:#80d8b2 !important; }
html.dark-mode [class~="text-[#065f46]"],
html.dark-mode [class~="text-[#166534]"] { color:#86dfa4 !important; }
html.dark-mode [class~="text-[#92400e]"],
html.dark-mode [class~="text-[#b45309]"] { color:#f4c86d !important; }
html.dark-mode [class~="text-[#b91c1c]"],
html.dark-mode [class~="text-[#991b1b]"] { color:#ff9292 !important; }
html.dark-mode [class~="text-[#1d4ed8]"] { color:#93b9ff !important; }
html.dark-mode [class~="text-red-700"],
html.dark-mode [class~="text-red-800"] { color:#ff9292 !important; }
html.dark-mode [class~="text-amber-800"],
html.dark-mode [class~="text-amber-900"] { color:#f4c86d !important; }
html.dark-mode [class~="text-green-700"],
html.dark-mode [class~="text-green-800"] { color:#86dfa4 !important; }
html.dark-mode [class~="hover:text-black"]:hover { color:#e8f0ec !important; }
html.dark-mode .status-badge[class~="bg-[#4ade80]"] {
    background-color:#4ade80 !important;
    border-color:#4ade80 !important;
    color:#083b26 !important;
}

/* Borders, dividers, fields, and tables */
html.dark-mode [class~="border-line"],
html.dark-mode [class~="border-[#d7e0f0]"],
html.dark-mode [class~="border-[#c7d2d9]"],
html.dark-mode [class~="border-[#e7edf5]"],
html.dark-mode [class~="border-[#dce4e0]"],
html.dark-mode [class~="border-[#cfe8df]"],
html.dark-mode [class~="border-[#cbd5e1]"] { border-color:#31443b !important; }
html.dark-mode [class~="border-[#bbf7d0]"],
html.dark-mode [class~="border-[#86efac]"] { border-color:#315d40 !important; }
html.dark-mode [class~="border-[#fecaca]"],
html.dark-mode [class~="border-[#fca5a5]"] { border-color:#71353a !important; }
html.dark-mode [class~="border-[#fde68a]"] { border-color:#6c5525 !important; }
html.dark-mode [class~="border-[#bfdbfe]"] { border-color:#304b69 !important; }
html.dark-mode hr { border-color:#31443b; }
html.dark-mode input:not([type="checkbox"]):not([type="radio"]),
html.dark-mode select,
html.dark-mode textarea {
    border-color:#40564b !important;
    background-color:#101b16 !important;
    color:#e8f0ec !important;
    color-scheme:dark;
}
html.dark-mode input::placeholder,
html.dark-mode textarea::placeholder { color:#83978c !important; opacity:1; }
html.dark-mode input[type="checkbox"],
html.dark-mode input[type="radio"] { accent-color:#68c9a2; }
html.dark-mode table { color:#e8f0ec; }
html.dark-mode .pp-create-dialog {
    border-color:#40564b !important;
    background:#14201b !important;
    color:#e8f0ec;
}
html.dark-mode .pp-create-dialog::backdrop { background:rgba(2,10,7,.76); }
html.dark-mode .pp-row:hover,
html.dark-mode [class~="hover:bg-[#f0f5ee]"]:hover { background-color:#1b2a23 !important; }
html.dark-mode [class~="hover:bg-white"]:hover { background-color:#263a30 !important; }
html.dark-mode [class~="shadow-glow"] { --tw-shadow-color:rgba(0,0,0,.42); }
html.dark-mode .prose {
    --tw-prose-body:#c6d2cc;
    --tw-prose-headings:#eef5f1;
    --tw-prose-lead:#b6c4bd;
    --tw-prose-links:#a0e2bf;
    --tw-prose-bold:#eef5f1;
    --tw-prose-counters:#a9bbb1;
    --tw-prose-bullets:#52655b;
    --tw-prose-hr:#31443b;
    --tw-prose-quotes:#e6efe9;
    --tw-prose-quote-borders:#40564b;
    --tw-prose-captions:#a9bbb1;
    --tw-prose-code:#e8f0ec;
    --tw-prose-pre-code:#e8f0ec;
    --tw-prose-pre-bg:#101b16;
    --tw-prose-th-borders:#40564b;
    --tw-prose-td-borders:#31443b;
}
html.dark-mode.admin-settings-document { background:#0d1512 !important; background-image:none !important; }
html.dark-mode.admin-settings-document .settings-page .shadow-glow { box-shadow:none !important; }

@media (prefers-reduced-motion: reduce) {
    .theme-toggle { transition:none; }
}
