/* DUNSK KUHNER "playful" theme (the website look). Loaded only while Admin > Appearance has it switched on.
   Everything is scoped to html[data-ui="dk"], so switching back to the original theme removes it completely. */

html[data-ui="dk"] {
    --bg: #FEF7E5; --card: #ffffff; --ink: #2F2D2A; --muted: #5C5A55; --line: #E7DFC9; --edge: #2F2D2A;
    --brand: #2F2D2A; --brand-dark: #000000; --accent: #FFD98A;
    --ok: #0b6b4f; --ok-bg: #B8F0DF; --err: #9a2f08; --err-bg: #F8C9A0;
    --shadow: none; --radius: 24px;
    --yellow: #FBBA14; --mint: #6FE8C4; --green: #00DAA0; --peach: #F8C9A0; --sun: #FFD98A; --lilac: #E5DAFF;
    --font: "Nunito", ui-rounded, "SF Pro Rounded", "Avenir Next Rounded", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --font-head: "Fredoka", "Nunito", ui-rounded, "SF Pro Rounded", "Avenir Next Rounded", "Segoe UI", system-ui, sans-serif;
}
html[data-ui="dk"][data-theme="dark"] {
    --bg: #1f1d1a; --card: #2b2824; --ink: #FEF7E5; --muted: #cbc2aa; --line: #4a453d; --edge: #FEF7E5;
    --brand: #FBBA14; --brand-dark: #ffd05a; --accent: #4a3d12;
    --ok: #6FE8C4; --ok-bg: #12382d; --err: #ffb089; --err-bg: #4a2412; --shadow: none;
}

/* Page, type */
html[data-ui="dk"] body { font-family: var(--font); background: var(--bg); color: var(--ink); font-weight: 500; }
html[data-ui="dk"] h1, html[data-ui="dk"] h2, html[data-ui="dk"] h3 { font-family: var(--font); font-weight: 800; letter-spacing: -.015em; }
html[data-ui="dk"] h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem); line-height: 1.1; }
html[data-ui="dk"] a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: var(--yellow); }
html[data-ui="dk"] a:hover { background: var(--yellow); color: #2F2D2A; text-decoration: none; }
html[data-ui="dk"] .muted, html[data-ui="dk"] .hint { color: var(--muted); }
html[data-ui="dk"] code { background: var(--sun); color: #2F2D2A; }
html[data-ui="dk"] ::selection { background: var(--yellow); color: #2F2D2A; }

/* Top bar */
html[data-ui="dk"] .topbar { background: var(--bg); border-bottom: 3px solid var(--edge); border-image: none; box-shadow: none; padding: 12px 24px; }
html[data-ui="dk"] .brand { text-decoration: none; }
html[data-ui="dk"] .brand:hover { background: transparent; }
html[data-ui="dk"] .brand-text { font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; letter-spacing: .01em; color: var(--ink); }
html[data-ui="dk"] .usermenu summary { border: 3px solid var(--edge); border-radius: 999px; background: var(--card); padding: 4px 14px 4px 4px; }
html[data-ui="dk"] .usermenu summary:hover, html[data-ui="dk"][data-theme="dark"] .usermenu summary:hover { background: var(--sun); color: #2F2D2A; }
html[data-ui="dk"] .avatar { background: var(--green); color: #2F2D2A; font-weight: 800; }
html[data-ui="dk"] .menu { border: 3px solid var(--edge); border-radius: 28px; box-shadow: 6px 6px 0 var(--edge); background: var(--card); }
html[data-ui="dk"] .menu-links a { border-radius: 999px; padding: 4px 12px; text-decoration: none; font-weight: 700; }
html[data-ui="dk"] .nav-toggle { border: 3px solid var(--edge); border-radius: 999px; background: var(--card); }
html[data-ui="dk"] .nav-toggle span { background: var(--ink); }

/* Buttons */
html[data-ui="dk"] .btn { border: 3px solid var(--edge); border-radius: 999px; background: transparent; color: var(--ink); font-weight: 800; padding: 8px 20px; min-height: 42px; transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease; text-decoration: none; }
html[data-ui="dk"] .btn:hover { background: var(--card); color: var(--ink); border-color: var(--edge); transform: scale(1.03) rotate(-1deg); box-shadow: 0 5px 0 var(--yellow); }
html[data-ui="dk"] .btn-primary { background: var(--edge); border-color: var(--edge); color: var(--bg); }
html[data-ui="dk"] .btn-primary:hover { background: var(--edge); color: var(--bg); box-shadow: 0 5px 0 var(--yellow); }
html[data-ui="dk"][data-theme="dark"] .btn-primary { background: var(--yellow); border-color: var(--yellow); color: #2F2D2A; }
html[data-ui="dk"][data-theme="dark"] .btn-primary:hover { background: var(--yellow); color: #2F2D2A; }
html[data-ui="dk"] .btn-small { padding: 3px 14px; min-height: 34px; }
html[data-ui="dk"] .btn-ghost { background: transparent; }
html[data-ui="dk"] .topbar .btn-ghost { color: var(--ink); border-color: var(--edge); }
html[data-ui="dk"] .topbar .btn-ghost:hover { background: var(--sun); color: #2F2D2A; }
html[data-ui="dk"] .btn:focus-visible, html[data-ui="dk"] a:focus-visible, html[data-ui="dk"] button:focus-visible, html[data-ui="dk"] summary:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

/* Cards and panels */
html[data-ui="dk"] .card, html[data-ui="dk"] .login-card, html[data-ui="dk"] .modal-box, html[data-ui="dk"] .busy-box, html[data-ui="dk"] .toast {
    border: 3px solid var(--edge); border-radius: 28px; box-shadow: none; background: var(--card); }
html[data-ui="dk"] .login-card { border-radius: 56px 24px 56px 24px; background: var(--bg); padding: 34px 30px; }
html[data-ui="dk"] .login-page { background: radial-gradient(var(--mint) 1.6px, transparent 1.7px) 0 0 / 28px 28px, var(--card); }
html[data-ui="dk"][data-theme="dark"] .login-page { background: radial-gradient(#2d5a4c 1.6px, transparent 1.7px) 0 0 / 28px 28px, var(--bg); }
html[data-ui="dk"] .busy-box { border-radius: 28px; }
html[data-ui="dk"] .page-head h1 { margin-bottom: 4px; }
html[data-ui="dk"] .section h2 { color: var(--ink); border-bottom: 3px solid var(--yellow); display: inline-block; padding-bottom: 2px; }
html[data-ui="dk"] .desc { background: var(--bg); border: 3px solid var(--edge); border-radius: 22px; }

/* Stat tiles: each in its own colour */
html[data-ui="dk"] .stat { border: 3px solid var(--edge); border-radius: 40px 28px 40px 28px; box-shadow: none; padding: 16px 20px; background: var(--card); color: #2F2D2A; transition: transform .2s ease, box-shadow .2s ease; }
html[data-ui="dk"] .stat:nth-child(5n+2) { background: var(--sun); }
html[data-ui="dk"] .stat:nth-child(5n+3) { background: var(--yellow); }
html[data-ui="dk"] .stat:nth-child(5n+4) { background: var(--mint); }
html[data-ui="dk"] .stat:nth-child(5n+5) { background: var(--peach); }
html[data-ui="dk"] .stat-accent { background: var(--mint); border-color: var(--edge); }
html[data-ui="dk"] .stat .stat-n, html[data-ui="dk"] .stat-accent .stat-n { color: #2F2D2A; font-weight: 800; font-size: 2.1rem; }
html[data-ui="dk"] .stat .stat-l { color: #2F2D2A; font-weight: 700; }
html[data-ui="dk"] .stat:hover { transform: translateY(-4px) rotate(-1deg); box-shadow: 0 8px 0 var(--edge); }

/* Forms */
html[data-ui="dk"] label { font-weight: 800; }
html[data-ui="dk"] input[type=text], html[data-ui="dk"] input[type=email], html[data-ui="dk"] input[type=password], html[data-ui="dk"] input[type=search],
html[data-ui="dk"] input[type=number], html[data-ui="dk"] input[type=date], html[data-ui="dk"] input[type=month], html[data-ui="dk"] select {
    border: 3px solid var(--edge); border-radius: 999px; background-color: var(--bg); color: var(--ink); padding: 8px 18px; font-family: var(--font); font-weight: 600; }
html[data-ui="dk"] input[type=date], html[data-ui="dk"] input[type=month] { padding-right: 44px; }
html[data-ui="dk"] textarea { border: 3px solid var(--edge); border-radius: 24px; background: var(--bg); color: var(--ink); padding: 12px 18px; font-family: var(--font); font-weight: 600; }
html[data-ui="dk"] input:focus, html[data-ui="dk"] select:focus, html[data-ui="dk"] textarea:focus { outline: 3px solid var(--yellow); outline-offset: 2px; border-color: var(--edge); }
html[data-ui="dk"] input::placeholder, html[data-ui="dk"] textarea::placeholder { color: var(--muted); opacity: .8; }
html[data-ui="dk"] input.is-locked, html[data-ui="dk"] input[readonly].is-locked { background: var(--line); color: var(--muted); border-color: var(--line); }
html[data-ui="dk"][data-theme="dark"] input[type=text], html[data-ui="dk"][data-theme="dark"] input[type=email], html[data-ui="dk"][data-theme="dark"] input[type=password],
html[data-ui="dk"][data-theme="dark"] input[type=search], html[data-ui="dk"][data-theme="dark"] input[type=date], html[data-ui="dk"][data-theme="dark"] select,
html[data-ui="dk"][data-theme="dark"] textarea { background-color: #1f1d1a; color: var(--ink); border-color: var(--edge); }
html[data-ui="dk"] input[type=checkbox], html[data-ui="dk"] input[type=radio] { accent-color: #2F2D2A; width: 1.1em; height: 1.1em; }
html[data-ui="dk"][data-theme="dark"] input[type=checkbox], html[data-ui="dk"][data-theme="dark"] input[type=radio] { accent-color: var(--yellow); }
html[data-ui="dk"] .check { color: var(--ink); }

/* Messages */
html[data-ui="dk"] .alert { border: 3px solid var(--edge); border-radius: 22px; font-weight: 700; }
html[data-ui="dk"] .alert-ok { background: var(--ok-bg); color: var(--ok); border: 3px solid var(--edge); }
html[data-ui="dk"] .alert-error { background: var(--err-bg); color: var(--err); }
html[data-ui="dk"] .alert-warn { background: var(--sun); color: #2F2D2A; }
html[data-ui="dk"] .empty-note { color: var(--muted); }

/* Tables */
html[data-ui="dk"] .table th { text-transform: none; letter-spacing: 0; font-size: .85rem; font-weight: 800; color: var(--muted); border-bottom: 3px solid var(--edge); }
html[data-ui="dk"] .table td { border-bottom: 2px solid var(--line); }
html[data-ui="dk"] .table tbody tr:hover, html[data-ui="dk"] .table tbody tr[data-href]:hover { background: #FFF1C2; }
html[data-ui="dk"][data-theme="dark"] .table tbody tr:hover, html[data-ui="dk"][data-theme="dark"] .table tbody tr[data-href]:hover { background: #3a3220; }
html[data-ui="dk"] .table thead th { background: transparent; }
html[data-ui="dk"][data-theme="dark"] .table thead th { background: transparent; color: var(--muted); }

/* Pills */
html[data-ui="dk"] .tag, html[data-ui="dk"] .status, html[data-ui="dk"] .alert-pill { border-radius: 999px; font-weight: 800; border: 2px solid var(--edge); padding: 1px 10px; }
html[data-ui="dk"] .tag { background: #E7DFC9; color: #2F2D2A; }
html[data-ui="dk"] .tag-hr { background: var(--lilac); color: #2F2D2A; }
html[data-ui="dk"] .tag-rc { background: var(--mint); color: #2F2D2A; }
html[data-ui="dk"] .tag-charges { background: var(--peach); color: #2F2D2A; }
html[data-ui="dk"] .status-open { background: var(--yellow); color: #2F2D2A; }
html[data-ui="dk"] .status-review { background: var(--mint); color: #2F2D2A; }
html[data-ui="dk"] .status-closed { background: var(--green); color: #2F2D2A; }
html[data-ui="dk"] .alert-pill { background: #C2410C; color: #FFF6EA; border-color: #C2410C; }
html[data-ui="dk"] .alert-pill.warn { background: var(--yellow); color: #2F2D2A; border-color: var(--edge); }
html[data-ui="dk"] .alert-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-width: 100%; }
html[data-ui="dk"] .alert-stack .alert-pill { white-space: normal; max-width: 100%; box-sizing: border-box; line-height: 1.2; padding: 2px 9px; font-size: .74rem; }
html[data-ui="dk"] .chip-ir { border: 3px solid var(--edge); background: var(--card); color: var(--ink); font-weight: 800; }
html[data-ui="dk"] .chip-ir:hover { background: var(--yellow); border-color: var(--edge); color: #2F2D2A; }

/* RCA / CAR badges */
html[data-ui="dk"] .rca-badge { border-radius: 999px; font-weight: 800; border: 2px solid var(--edge); color: #2F2D2A; }
html[data-ui="dk"] .rca-ok { background: var(--mint); }
html[data-ui="dk"] .rca-bad { background: var(--peach); }
html[data-ui="dk"] .rca-wait { background: var(--sun); }
html[data-ui="dk"] .rca-rev { border: 3px solid var(--edge); border-radius: 24px; background: var(--card); }

/* Footer */
html[data-ui="dk"] .footer { background: #2F2D2A; color: #FEF7E5; border-top: 0; font-weight: 700; padding: 22px; }
html[data-ui="dk"][data-theme="dark"] .footer { background: #12110f; }

@media (max-width: 860px) {
    html[data-ui="dk"] .topbar { padding: 10px 14px; }
    html[data-ui="dk"] .stat { border-radius: 30px 22px 30px 22px; }
}
@media (prefers-reduced-motion: reduce) {
    html[data-ui="dk"] .btn, html[data-ui="dk"] .stat { transition: none; }
    html[data-ui="dk"] .btn:hover, html[data-ui="dk"] .stat:hover { transform: none; }
}
@media print {
    html[data-ui="dk"] .footer { background: transparent; color: #000; }
}

/* Stat tiles: hide the thin colour strip of the original (the whole tile is coloured instead) */
html[data-ui="dk"] .stat::before { display: none; }
html[data-ui="dk"] .toolbar .fld input[type=search] { flex: 0 0 auto; }
html[data-ui="dk"] .stat.active { outline: 4px solid var(--yellow); outline-offset: 2px; }

/* Pop-up windows (edit IR): the page inside is already inside the pop-up's own frame, so no second frame, and some breathing room */
html[data-ui="dk"] body.modal-embed { background: var(--bg); }
html[data-ui="dk"] body.modal-embed .page { padding: 20px 26px 28px; }
html[data-ui="dk"] body.modal-embed .card { border: 0; border-radius: 0; padding: 0; background: transparent; box-shadow: none; }
html[data-ui="dk"] .modal-box { overflow: hidden; }
html[data-ui="dk"] .modal-box iframe { background: var(--bg); border-radius: 0 0 24px 24px; }
html[data-ui="dk"] body.modal-embed .detail-head { align-items: flex-start; gap: 12px; margin-bottom: 6px; }
html[data-ui="dk"] body.modal-embed h1 { margin-top: 4px; }
html[data-ui="dk"] body.modal-embed .section h2 { margin-top: 18px; }
html[data-ui="dk"] body.modal-embed .actions { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; }
