/*
 * Evergreen UI for YOURLS
 * Modern, compact and reversible interface layer.
 * Intentionally unlayered: YOURLS core CSS is unlayered, and layered rules would
 * lose to it regardless of selector specificity.
 */

:root {
    --wk-accent: #635bff;
    --wk-accent-hover: color-mix(in srgb, var(--wk-accent) 86%, #000);
    --wk-accent-contrast: #fff;
    --wk-accent-soft: color-mix(in srgb, var(--wk-accent) 10%, transparent);
    --wk-accent-softer: color-mix(in srgb, var(--wk-accent) 5%, transparent);

    --wk-bg: #f7f7f8;
    --wk-surface: #ffffff;
    --wk-surface-raised: #ffffff;
    --wk-surface-soft: #f4f4f5;
    --wk-surface-hover: #f0f0f2;
    --wk-text: #18181b;
    --wk-text-strong: #09090b;
    --wk-muted: #71717a;
    --wk-muted-2: #a1a1aa;
    --wk-border: #e4e4e7;
    --wk-border-strong: #d4d4d8;
    --wk-overlay: rgb(9 9 11 / 56%);

    --wk-danger: #dc2626;
    --wk-danger-soft: #fef2f2;
    --wk-success: #15803d;
    --wk-success-soft: #f0fdf4;
    --wk-warning: #a16207;
    --wk-warning-soft: #fffbeb;

    --wk-radius-xs: 5px;
    --wk-radius-sm: 7px;
    --wk-radius: 10px;
    --wk-radius-lg: 14px;
    --wk-shadow-xs: 0 1px 2px rgb(9 9 11 / 4%);
    --wk-shadow-sm: 0 1px 3px rgb(9 9 11 / 7%), 0 1px 2px rgb(9 9 11 / 4%);
    --wk-shadow-lg: 0 18px 50px rgb(9 9 11 / 15%);

    --wk-content: 1600px;
    --wk-page-pad: clamp(12px, 1.8vw, 24px);
    --wk-section-gap: 14px;
    --wk-control: 36px;
    --wk-control-small: 30px;
    --wk-font-size: 14px;
    --wk-line: 1.45;
    --wk-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --wk-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

    color-scheme: light;
}

:root[data-wk-theme="dark"] {
    --wk-bg: #09090b;
    --wk-surface: #141416;
    --wk-surface-raised: #18181b;
    --wk-surface-soft: #1f1f23;
    --wk-surface-hover: #27272a;
    --wk-text: #e4e4e7;
    --wk-text-strong: #fafafa;
    --wk-muted: #a1a1aa;
    --wk-muted-2: #71717a;
    --wk-border: #29292e;
    --wk-border-strong: #3f3f46;
    --wk-overlay: rgb(0 0 0 / 72%);
    --wk-accent-hover: color-mix(in srgb, var(--wk-accent) 82%, #fff);
    --wk-accent-soft: color-mix(in srgb, var(--wk-accent) 18%, transparent);
    --wk-accent-softer: color-mix(in srgb, var(--wk-accent) 9%, transparent);
    --wk-danger: #f87171;
    --wk-danger-soft: color-mix(in srgb, #ef4444 14%, var(--wk-surface));
    --wk-success: #4ade80;
    --wk-success-soft: color-mix(in srgb, #22c55e 12%, var(--wk-surface));
    --wk-warning: #facc15;
    --wk-warning-soft: color-mix(in srgb, #eab308 12%, var(--wk-surface));
    --wk-shadow-xs: 0 1px 2px rgb(0 0 0 / 25%);
    --wk-shadow-sm: 0 1px 3px rgb(0 0 0 / 35%), 0 1px 2px rgb(0 0 0 / 22%);
    --wk-shadow-lg: 0 20px 60px rgb(0 0 0 / 52%);
    color-scheme: dark;
}

html[data-wk-theme="light"] { background: #f7f7f8; }
html[data-wk-theme="dark"] { background: #09090b; }

body.wk-density-compact {
    --wk-section-gap: 10px;
    --wk-control: 32px;
    --wk-control-small: 28px;
    --wk-font-size: 13px;
}

/* Foundation and legacy reset */
body.wk-evui,
body.wk-evui :where(div, p, td, th, input, select, textarea, button) {
    font-family: var(--wk-font);
    font-size: inherit;
}

body.wk-evui,
body.wk-evui *,
body.wk-evui *::before,
body.wk-evui *::after {
    box-sizing: border-box;
}

body.wk-evui {
    min-width: 0;
    margin: 0;
    padding: 0;
    background: var(--wk-bg);
    color: var(--wk-text);
    font-size: var(--wk-font-size);
    line-height: var(--wk-line);
    text-align: left;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body.wk-evui :where(img, svg, canvas, video) { max-width: 100%; }
body.wk-evui :where(button, input, select, textarea) { font: inherit; }
body.wk-evui :where(input, select, textarea, button) { color-scheme: inherit; }

body.wk-evui #wrap,
body.wk-evui #footer {
    width: min(100%, var(--wk-content));
    max-width: var(--wk-content);
    margin-inline: auto;
}

body.wk-evui #wrap {
    min-height: calc(100dvh - 52px);
    padding: 0 var(--wk-page-pad) 22px;
    border: 0;
    border-radius: 0;
    background: transparent;
    text-align: left;
}

body.wk-evui main,
body.wk-evui .sub_wrap {
    min-width: 0;
    max-width: none;
    text-align: left;
}

body.wk-evui :where(h1, h2, h3, h4, h5, h6) {
    color: var(--wk-text-strong);
    font-family: var(--wk-font);
    font-weight: 720;
    letter-spacing: -0.025em;
}

body.wk-evui h2 {
    margin: 0 0 10px;
    font-size: clamp(20px, 2vw, 27px);
    line-height: 1.18;
}

body.wk-evui h3 { margin: 0 0 8px; font-size: 16px; }
body.wk-evui p { color: var(--wk-muted); }
body.wk-evui a,
body.wk-evui a:link,
body.wk-evui a:active,
body.wk-evui a:visited {
    color: var(--wk-accent-hover);
    text-decoration: none;
    text-underline-offset: 2px;
}
body.wk-evui a:hover { color: var(--wk-accent-hover); text-decoration: underline; }
body.wk-evui :focus-visible {
    outline: 2px solid color-mix(in srgb, var(--wk-accent) 72%, #fff);
    outline-offset: 2px;
}

body.wk-evui :where(code, tt, kbd, pre) {
    border-radius: 4px;
    background: var(--wk-surface-soft);
    color: var(--wk-text);
    font-family: var(--wk-mono);
}
body.wk-evui :where(code, tt, kbd) { padding: 1px 4px; }
body.wk-evui pre { max-width: 100%; padding: 10px; overflow: auto; }

/* Compact app header */
body.wk-evui header[role="banner"] {
    position: relative;
    display: flex;
    min-height: 54px;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

body.wk-evui header[role="banner"] h1 {
    float: none;
    flex: 0 0 auto;
    max-width: none;
    margin: 0;
    line-height: 1;
}
body.wk-evui header[role="banner"] h1 > a {
    display: inline-flex;
    float: none;
    align-items: center;
    color: var(--wk-text-strong);
    font-size: 0;
    text-align: left;
}
body.wk-evui #yourls-logo {
    width: 104px;
    height: auto;
    border: 0;
    filter: saturate(.72) contrast(.96);
}
:root[data-wk-theme="dark"] body.wk-evui #yourls-logo {
    filter: brightness(1.7) saturate(.45) contrast(.9);
}

.wk-evui-brand-caption {
    display: inline-flex;
    min-width: 0;
    max-width: min(52vw, 480px);
    align-items: center;
    gap: 9px;
    margin: 0;
}
.wk-evui-brand-mark {
    display: inline-grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 8px;
    background: var(--wk-accent);
    color: var(--wk-accent-contrast);
    font-size: 15px;
    font-weight: 850;
    box-shadow: var(--wk-shadow-xs);
}
.wk-evui-brand-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    line-height: 1.16;
}
.wk-evui-brand-copy strong {
    overflow: hidden;
    color: var(--wk-text-strong);
    font-size: 14px;
    font-weight: 760;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wk-evui-brand-copy > span {
    overflow: hidden;
    color: var(--wk-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body.wk-evui.wk-brand-custom header[role="banner"] h1 { display: none; }

.wk-evui-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}
.wk-evui-icon-button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    min-height: 34px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--wk-border);
    border-radius: 8px;
    background: var(--wk-surface);
    color: var(--wk-muted);
    box-shadow: var(--wk-shadow-xs);
    cursor: pointer;
    transition: background-color .14s ease, border-color .14s ease, color .14s ease, transform .14s ease;
}
.wk-evui-icon-button:hover {
    border-color: var(--wk-border-strong);
    background: var(--wk-surface-hover);
    color: var(--wk-text-strong);
    transform: translateY(-1px);
}
.wk-evui-menu-toggle { display: none; }

/* Navigation */
body.wk-evui nav[role="navigation"] {
    position: sticky;
    z-index: 30;
    top: 8px;
    margin: 0 0 var(--wk-section-gap);
    padding: 4px;
    border: 1px solid var(--wk-border);
    border-radius: 10px;
    background: color-mix(in srgb, var(--wk-surface) 92%, transparent);
    box-shadow: var(--wk-shadow-xs);
    backdrop-filter: blur(16px) saturate(1.25);
    -webkit-backdrop-filter: blur(16px) saturate(1.25);
}
body.wk-evui #admin_menu {
    display: flex;
    min-height: 0;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: inherit;
}
body.wk-evui #admin_menu > li {
    position: relative;
    margin: 0;
    padding: 0;
    color: var(--wk-muted);
    list-style: none;
}
body.wk-evui #admin_menu > li:hover { color: inherit; list-style: none; }
body.wk-evui #admin_menu a {
    display: block;
    padding: 7px 10px;
    border-radius: 7px;
    color: var(--wk-text);
    font-size: 13px;
    font-weight: 620;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}
body.wk-evui #admin_menu a:hover,
body.wk-evui #admin_menu a:focus-visible {
    background: var(--wk-surface-hover);
    color: var(--wk-text-strong);
    text-decoration: none;
}
body.wk-evui #admin_menu_logout_link {
    margin-left: auto !important;
    padding: 0 8px !important;
    color: var(--wk-muted);
    font-size: 12px;
    white-space: nowrap;
}
body.wk-evui #admin_menu_logout_link a {
    display: inline;
    padding: 0;
    color: var(--wk-accent-hover);
    font-size: inherit;
}
body.wk-evui #admin_menu > li > ul {
    position: absolute;
    z-index: 60;
    top: calc(100% - 1px);
    left: 0;
    display: block;
    min-width: 190px;
    max-width: min(320px, calc(100vw - 16px));
    margin: 0;
    padding: 5px;
    border: 1px solid var(--wk-border);
    border-radius: 9px;
    background: var(--wk-surface-raised);
    box-shadow: var(--wk-shadow-lg);
    list-style: none;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transform-origin: top left;
    transition:
        opacity .12s ease .08s,
        transform .12s ease .08s,
        visibility 0s linear .22s;
}
/* An invisible pointer corridor prevents a dead zone between trigger and menu. */
body.wk-evui #admin_menu > li > ul::before {
    content: '';
    position: absolute;
    right: -1px;
    bottom: 100%;
    left: -1px;
    height: 9px;
}
body.wk-evui #admin_menu > li:hover > ul,
body.wk-evui #admin_menu > li:focus-within > ul,
body.wk-evui #admin_menu > li.wk-submenu-open > ul {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 0s;
}
body.wk-evui #admin_menu > li.wk-submenu-dismissed > ul {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: none;
}
body.wk-evui #admin_menu ul li { margin: 0; padding: 0; list-style: none; }
body.wk-evui #admin_menu ul a { width: 100%; padding: 8px 9px; }
body.wk-evui #admin_menu > li.wk-submenu-align-right > ul { right: 0; left: auto; transform-origin: top right; }
body.wk-evui #admin_menu > li.is-current > a {
    background: color-mix(in srgb, var(--wk-accent) 12%, var(--wk-surface));
    color: var(--wk-text-strong);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wk-accent) 34%, transparent);
}
body.wk-evui #admin_menu > li.wk-has-submenu > a {
    padding-right: 28px;
}
body.wk-evui #admin_menu > li.wk-has-submenu::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    width: 8px;
    height: 8px;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    transform: translateY(-62%) rotate(45deg);
    opacity: .7;
    pointer-events: none;
}
body.wk-evui #admin_menu > li.wk-submenu-open::after,
body.wk-evui #admin_menu > li:hover::after,
body.wk-evui #admin_menu > li:focus-within::after {
    opacity: 1;
}

/* Forms and controls */
body.wk-evui :where(
    input:not([type]), input[type="text"], input[type="url"], input[type="email"], input[type="password"],
    input[type="tel"], input[type="number"], input[type="search"], input[type="date"], input[type="time"],
    input[type="month"], input[type="week"], input[type="datetime-local"], select, textarea
) {
    width: 100%;
    max-width: 100%;
    min-height: var(--wk-control);
    margin: 0;
    padding: 7px 10px;
    border: 1px solid var(--wk-border-strong);
    border-radius: var(--wk-radius-sm);
    background: var(--wk-surface);
    color: var(--wk-text-strong);
    box-shadow: var(--wk-shadow-xs);
    outline: none;
    transition: border-color .14s ease, box-shadow .14s ease, background-color .14s ease;
}
body.wk-evui :where(input, textarea)::placeholder { color: var(--wk-muted-2); opacity: 1; }
body.wk-evui textarea { min-height: 96px; resize: vertical; }
body.wk-evui :where(input, select, textarea):focus {
    border-color: color-mix(in srgb, var(--wk-accent) 72%, var(--wk-border-strong));
    box-shadow: 0 0 0 3px var(--wk-accent-soft);
}
body.wk-evui :where(input, select, textarea):disabled {
    opacity: .62;
    background: var(--wk-surface-soft);
    cursor: not-allowed;
}
body.wk-evui input[type="checkbox"],
body.wk-evui input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--wk-accent);
}
body.wk-evui input[type="color"] {
    width: 46px;
    min-width: 46px;
    height: var(--wk-control);
    padding: 3px;
    border: 1px solid var(--wk-border-strong);
    border-radius: var(--wk-radius-sm);
    background: var(--wk-surface);
}

body.wk-evui :where(.button, button, input.button, input[type="button"], input[type="submit"], input[type="reset"]) {
    display: inline-flex;
    min-height: var(--wk-control);
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    padding: 7px 11px;
    border: 1px solid var(--wk-border-strong);
    border-radius: var(--wk-radius-sm);
    background: var(--wk-surface);
    color: var(--wk-text);
    font-family: var(--wk-font);
    font-size: 13px;
    font-weight: 660;
    line-height: 1.1;
    text-decoration: none;
    box-shadow: var(--wk-shadow-xs);
    cursor: pointer;
    transition: background-color .14s ease, border-color .14s ease, color .14s ease, transform .14s ease, box-shadow .14s ease;
}
body.wk-evui :where(.button, button, input.button, input[type="button"], input[type="submit"], input[type="reset"]):hover {
    border-color: var(--wk-border-strong);
    background: var(--wk-surface-hover);
    color: var(--wk-text-strong);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--wk-shadow-sm);
}
body.wk-evui :where(.button.primary, button.primary, input.primary, #add-button) {
    border-color: var(--wk-accent);
    background: var(--wk-accent);
    color: var(--wk-accent-contrast);
}
body.wk-evui :where(.button.primary, button.primary, input.primary, #add-button):hover {
    border-color: var(--wk-accent-hover);
    background: var(--wk-accent-hover);
    color: var(--wk-accent-contrast);
}
body.wk-evui :where(.button, button, input.button).disabled,
body.wk-evui :where(.button, button, input.button):disabled,
body.wk-evui #add-button.disabled {
    border-color: var(--wk-border);
    background: var(--wk-surface-soft);
    color: var(--wk-muted);
    opacity: .65;
    pointer-events: none;
    transform: none;
}

/* Primary shortener */
body.wk-evui #new_url {
    clear: both;
    container-type: inline-size;
    margin: 0 0 var(--wk-section-gap);
    padding: 8px;
    border: 1px solid var(--wk-border);
    border-radius: calc(var(--wk-radius) + 2px);
    background: color-mix(in srgb, var(--wk-surface) 96%, var(--wk-surface-soft));
    box-shadow: var(--wk-shadow-xs);
    text-align: left;
}
body.wk-evui #new_url > div,
body.wk-evui #new_url_form,
body.wk-evui #new_url_form > div {
    margin: 0;
    padding: 0;
    background: transparent;
}
body.wk-evui #new_url_form {
    width: 100%;
    max-width: 1040px;
}
body.wk-evui #new_url_form > div {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(170px, 230px) max-content;
    align-items: end;
    gap: 8px;
}
body.wk-evui #new_url_form .wk-shortener-field {
    display: grid;
    min-width: 0;
    gap: 4px;
    margin: 0;
}
body.wk-evui #new_url_form .wk-shortener-heading {
    display: flex;
    min-width: 0;
    min-height: 14px;
    align-items: center;
    gap: 6px;
    color: var(--wk-muted);
    font-size: 10px;
    font-weight: 740;
    letter-spacing: .04em;
    line-height: 1.15;
    text-transform: uppercase;
}
body.wk-evui #new_url_form .wk-shortener-optional {
    color: var(--wk-muted-2);
    font-size: 9px;
    font-weight: 720;
    letter-spacing: .035em;
}
body.wk-evui #new_url_form .wk-shortener-control {
    position: relative;
    min-width: 0;
}
body.wk-evui #new_url_form :where(#add-url, #add-keyword) {
    box-sizing: border-box !important;
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 7px 10px !important;
    border: 1px solid var(--wk-border-strong) !important;
    border-radius: 8px !important;
    background: var(--wk-surface) !important;
    color: var(--wk-text-strong) !important;
    box-shadow: var(--wk-shadow-xs) !important;
    outline: 0 !important;
    font-family: var(--wk-font) !important;
    line-height: 22px !important;
    transition: border-color .14s ease, box-shadow .14s ease, background-color .14s ease !important;
}
body.wk-evui #new_url_form #add-url {
    font-size: 14px !important;
    font-weight: 560;
}
body.wk-evui #new_url_form #add-keyword {
    font-size: 13px !important;
}
body.wk-evui #new_url_form :where(#add-url, #add-keyword):hover {
    border-color: color-mix(in srgb, var(--wk-accent) 34%, var(--wk-border-strong)) !important;
}
body.wk-evui #new_url_form :where(#add-url, #add-keyword):focus,
body.wk-evui #new_url_form :where(#add-url, #add-keyword):focus-visible {
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 7px 10px !important;
    border-width: 1px !important;
    border-color: var(--wk-accent) !important;
    outline: 0 !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wk-accent) 42%, transparent), var(--wk-shadow-xs) !important;
}
body.wk-evui #new_url_form .wk-shortener-action {
    display: flex;
    align-items: end;
}
body.wk-evui #new_url_form #add-button {
    box-sizing: border-box !important;
    width: auto !important;
    min-width: 104px;
    height: 38px !important;
    min-height: 38px !important;
    margin: 0 !important;
    padding: 0 14px !important;
    border-width: 1px !important;
    border-radius: 8px;
    align-self: end;
    font-size: 13px;
    line-height: 36px !important;
    white-space: nowrap;
    transform: none !important;
}
body.wk-evui #new_url_form #add-button:hover,
body.wk-evui #new_url_form #add-button:focus,
body.wk-evui #new_url_form #add-button:focus-visible {
    height: 38px !important;
    min-height: 38px !important;
    margin: 0 !important;
    border-width: 1px !important;
    outline: 0 !important;
    transform: none !important;
}
body.wk-evui #new_url_form .wk-shortener-extra {
    grid-column: 1 / -1;
    min-width: 0;
}
body.wk-evui #new_url #feedback,
body.wk-evui #feedback {
    width: auto;
    margin: 7px 0 0;
    padding: 7px 9px;
    border: 1px solid var(--wk-border);
    border-radius: var(--wk-radius-sm);
    background: var(--wk-surface-soft);
    color: var(--wk-text);
    text-align: left;
}
body.wk-evui #new_url #feedback:empty,
body.wk-evui #feedback:empty { display: none !important; }
body.wk-evui #new_url #feedback .fail { color: var(--wk-danger); }

/* The full navigation is already visible on desktops. A hamburger there is redundant. */
@media (min-width: 841px) {
    body.wk-evui .wk-evui-menu-toggle { display: none !important; }
}

@container (max-width: 720px) {
    body.wk-evui #new_url_form > div {
        grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
    }
    body.wk-evui #new_url_form .wk-shortener-primary { grid-column: 1 / -1; }
    body.wk-evui #new_url_form .wk-shortener-action { justify-content: stretch; }
    body.wk-evui #new_url_form #add-button { width: 100% !important; }
}

@container (max-width: 480px) {
    body.wk-evui #new_url { padding: 7px; }
    body.wk-evui #new_url_form > div { grid-template-columns: 1fr; gap: 7px; }
    body.wk-evui #new_url_form .wk-shortener-primary { grid-column: auto; }
    body.wk-evui #new_url_form :where(#add-url, #add-keyword) {
        height: 44px !important;
        min-height: 44px !important;
        padding: 9px 11px !important;
        font-size: 16px !important;
        line-height: 24px !important;
    }
    body.wk-evui #new_url_form :where(#add-url, #add-keyword):focus,
    body.wk-evui #new_url_form :where(#add-url, #add-keyword):focus-visible {
        height: 44px !important;
        min-height: 44px !important;
        padding: 9px 11px !important;
    }
    body.wk-evui #new_url_form #add-button,
    body.wk-evui #new_url_form #add-button:hover,
    body.wk-evui #new_url_form #add-button:focus,
    body.wk-evui #new_url_form #add-button:focus-visible {
        width: 100% !important;
        height: 44px !important;
        min-height: 44px !important;
        line-height: 42px !important;
    }
}

/* Filters, pagination and generic forms */
body.wk-evui #filter_form {
    float: none;
    width: 100%;
    max-width: none;
    margin: 0 0 var(--wk-section-gap);
    padding: 10px;
    border: 1px solid var(--wk-border);
    border-radius: var(--wk-radius);
    background: var(--wk-surface);
    color: var(--wk-muted);
    box-shadow: var(--wk-shadow-xs);
    text-align: left;
}
body.wk-evui #filter_form form { width: 100%; margin: 0; }
body.wk-evui #filter_form #filter_options {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 7px;
}
body.wk-evui #filter_form :where(input, select) { width: auto; min-width: 92px; }
body.wk-evui #filter_form input[type="text"] { min-width: min(220px, 100%); }

/* Enhanced mode converts YOURLS' sentence-style filter markup into a real field grid. */
body.wk-evui #filter_form #filter_options.wk-filter-enhanced {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 8px;
    align-items: end;
    font-size: 0;
}
body.wk-evui .wk-filter-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}
body.wk-evui .wk-filter-field > span {
    color: var(--wk-muted);
    font-size: 10px;
    font-weight: 740;
    line-height: 1.25;
    letter-spacing: .035em;
    text-transform: uppercase;
}
body.wk-evui .wk-filter-field > :where(input, select) {
    width: 100% !important;
    min-width: 0 !important;
}
body.wk-evui #filter_form #filter_options.wk-filter-enhanced > br,
body.wk-evui #filter_form #filter_options.wk-filter-enhanced > #date_and { display: none !important; }
body.wk-evui #filter_buttons {
    float: none;
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    font-size: var(--wk-font-size);
}
body.wk-evui #filter_buttons :where(input, button) { margin: 0; }
body.wk-evui .wk-filter-toggle {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    padding-inline: 11px;
    border-color: var(--wk-border);
    background: var(--wk-surface-soft);
    color: var(--wk-text-strong);
    font-weight: 700;
}
body.wk-evui .wk-filter-toggle::after {
    content: "⌄";
    color: var(--wk-muted);
    font-size: 16px;
    line-height: 1;
    transition: transform .18s ease;
}
body.wk-evui #filter_form:not(.wk-filter-collapsed) .wk-filter-toggle::after { transform: rotate(180deg); }

body.wk-evui #pagination {
    float: none;
    display: block;
    width: auto;
    margin: 10px 0;
    color: var(--wk-muted);
    text-align: left;
}
body.wk-evui #pagination .navigation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
}
body.wk-evui #pagination .navigation > .nav_total {
    display: block;
    flex: 1 0 100%;
    margin: 0 0 3px;
    color: var(--wk-muted);
    font-size: 11px;
}
body.wk-evui #pagination .navigation > .nav_link { display: inline-flex; }
body.wk-evui #pagination .navigation > .nav_link::before,
body.wk-evui #pagination .navigation > .nav_link::after { content: none; }
body.wk-evui #pagination .navigation > .nav_link > a,
body.wk-evui #pagination .navigation > .nav_current,
body.wk-evui #pagination > a,
body.wk-evui #pagination > span.current {
    display: inline-grid;
    min-width: 30px;
    min-height: 30px;
    margin: 0;
    place-items: center;
    padding: 4px 7px;
    border: 1px solid var(--wk-border);
    border-radius: 6px;
    background: var(--wk-surface);
    color: var(--wk-muted);
    text-align: center;
    text-decoration: none;
}
body.wk-evui #pagination .navigation > .nav_link > a:hover,
body.wk-evui #pagination > a:hover {
    border-color: var(--wk-border-strong);
    background: var(--wk-surface-hover);
    color: var(--wk-text-strong);
    text-decoration: none;
}
body.wk-evui #pagination .navigation > .nav_current,
body.wk-evui #pagination > span.current {
    border-color: color-mix(in srgb, var(--wk-accent) 40%, var(--wk-border));
    background: var(--wk-accent-soft);
    color: var(--wk-text-strong);
    font-weight: 760;
}

/* Tables */
.wk-evui-table-scroll {
    width: 100%;
    margin: 8px 0 12px;
    overflow-x: auto;
    border: 1px solid var(--wk-border);
    border-radius: var(--wk-radius);
    background: var(--wk-surface);
    box-shadow: var(--wk-shadow-xs);
    scrollbar-color: var(--wk-border-strong) transparent;
}
body.wk-evui table {
    width: 100%;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    border-spacing: 0;
    background: transparent;
    color: var(--wk-text);
    text-align: left;
}
body.wk-evui table :where(th, td) {
    height: auto;
    border: 0;
    border-bottom: 1px solid var(--wk-border);
    background: transparent;
    color: var(--wk-text);
    font-family: var(--wk-font);
    font-size: 13px;
    line-height: 1.35;
    text-align: left;
}
/*
 * YOURLS' legacy tablesorter rules use selectors such as
 * `table.tblSorter tbody td` and hard-code a white background / dark text.
 * Match that structure explicitly so both themes remain complete.
 */
body.wk-evui table.tblSorter,
body.wk-evui table.tblSorter tbody,
body.wk-evui table.tblSorter tbody tr {
    background-color: transparent;
    color: var(--wk-text);
}
body.wk-evui table th,
body.wk-evui table.tblSorter thead tr th,
body.wk-evui table.tblSorter tfoot tr th,
body.wk-evui table.tblSorter th.header,
body.wk-evui table.tablesorter thead tr th,
body.wk-evui table.tablesorter tfoot tr th {
    padding: 8px 9px;
    border-color: var(--wk-border);
    background-color: var(--wk-surface-soft);
    color: var(--wk-muted);
    font-size: 10px;
    font-weight: 760;
    letter-spacing: .055em;
    text-transform: uppercase;
    white-space: nowrap;
}
body.wk-evui table td,
body.wk-evui table.tblSorter tbody td {
    padding: 8px 9px;
    border-color: var(--wk-border);
    background-color: transparent;
    color: var(--wk-text);
    vertical-align: middle;
}
body.wk-evui table.tblSorter tbody tr.normal-row td,
body.wk-evui table.tblSorter tbody tr.alt-row td {
    background-color: transparent;
    color: var(--wk-text);
}
body.wk-evui table tbody tr:last-child td { border-bottom: 0; }
body.wk-evui table tbody tr:hover td,
body.wk-evui table.tblSorter tbody tr.normal-row:hover td,
body.wk-evui table.tblSorter tbody tr.alt-row:hover td { background: var(--wk-accent-softer); }
body.wk-evui table tbody tr:nth-child(even) td,
body.wk-evui table.tblSorter tbody tr:nth-child(even) td { background-color: color-mix(in srgb, var(--wk-surface-soft) 38%, transparent); }
body.wk-evui table tbody tr:nth-child(even):hover td,
body.wk-evui table.tblSorter tbody tr:nth-child(even):hover td { background: var(--wk-accent-softer); }
body.wk-evui tr.edit-row td {
    padding: 9px !important;
    background: var(--wk-accent-softer) !important;
}
body.wk-evui td.keyword a { font-family: var(--wk-mono); font-size: 12px; font-weight: 680; }
body.wk-evui td.url a:first-child { color: var(--wk-text-strong); font-weight: 620; }
body.wk-evui td.url small,
body.wk-evui td.url small a { color: var(--wk-muted); font-size: 11px; }
body.wk-evui td.timestamp { white-space: nowrap; }
body.wk-evui td.clicks { font-variant-numeric: tabular-nums; font-weight: 680; }
body.wk-evui td.actions { min-width: 174px; white-space: nowrap; }

/* Core hides these until hover. Evergreen keeps compact actions visible. */
body.wk-evui.desktop td.actions :where(input, a),
body.wk-evui td.actions :where(input, a) {
    opacity: 1;
    pointer-events: auto;
}
body.wk-evui td.actions .button {
    --wk-action-icon-size: 17px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    float: none;
    width: var(--wk-control-small);
    height: var(--wk-control-small);
    min-height: var(--wk-control-small);
    margin: 1px 3px 1px 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent !important;
    color: var(--wk-muted);
    box-shadow: none;
    font-size: 0;
    line-height: 0;
    text-indent: -9999px;
}
body.wk-evui td.actions .button:hover {
    border-color: var(--wk-border);
    background-color: var(--wk-surface-hover) !important;
    color: var(--wk-text-strong);
    transform: none;
}
body.wk-evui td.actions .button::before {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    display: block;
    width: var(--wk-action-icon-size);
    height: var(--wk-action-icon-size);
    background: currentColor;
    mask-position: center;
    mask-repeat: no-repeat;
    mask-size: contain;
    -webkit-mask-position: center;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: contain;
}
body.wk-evui td.actions .button_stats::before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 19V9m8 10V5m8 14v-7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 19V9m8 10V5m8 14v-7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
body.wk-evui td.actions .button_share::before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 8a3 3 0 1 0-2.8-4 3 3 0 0 0 .2 2.9L8.7 10a3 3 0 1 0 0 4l6.7 3.1A3 3 0 1 0 16 15l-6.7-3.1L16 8.8A3 3 0 0 0 18 8Z' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 8a3 3 0 1 0-2.8-4 3 3 0 0 0 .2 2.9L8.7 10a3 3 0 1 0 0 4l6.7 3.1A3 3 0 1 0 16 15l-6.7-3.1L16 8.8A3 3 0 0 0 18 8Z' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
body.wk-evui td.actions .button_copy::before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='8' y='8' width='11' height='11' rx='2' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='8' y='8' width='11' height='11' rx='2' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E");
}
body.wk-evui td.actions .button_edit::before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m4 20 4.2-1 10.9-10.9a2 2 0 0 0-2.8-2.8L5.4 16.2 4 20Z' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m4 20 4.2-1 10.9-10.9a2 2 0 0 0-2.8-2.8L5.4 16.2 4 20Z' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
}
body.wk-evui td.actions .button_delete { color: var(--wk-danger); }
body.wk-evui td.actions .button_delete::before {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 7h16m-10 4v6m4-6v6M9 7l1-3h4l1 3m3 0-1 13H7L6 7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 7h16m-10 4v6m4-6v6M9 7l1-3h4l1 3m3 0-1 13H7L6 7' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
body.wk-evui td.actions .button.loading,
body.wk-evui #add-button.loading {
    color: transparent;
    background: var(--wk-surface-soft) url("../../../../images/loading.gif") center no-repeat !important;
}

/* Tablesorter */
body.wk-evui table.tablesorter thead tr .header {
    padding-right: 22px;
    background-color: var(--wk-surface-soft);
    background-position: right 8px center;
}
body.wk-evui table.tablesorter tbody td { background-color: transparent; color: var(--wk-text); }
body.wk-evui table.tablesorter tbody tr.odd td { background-color: color-mix(in srgb, var(--wk-surface-soft) 48%, transparent); }
body.wk-evui table.tablesorter thead tr .headerSortUp,
body.wk-evui table.tablesorter thead tr .headerSortDown { color: var(--wk-text-strong); background-color: var(--wk-accent-soft); }

/* Notices and notifications */
body.wk-evui :where(.notice, .error, .success, .warning) {
    clear: both;
    width: auto;
    margin: 0 0 10px;
    padding: 9px 10px;
    border: 1px solid var(--wk-border);
    border-left: 3px solid var(--wk-accent);
    border-radius: var(--wk-radius-sm);
    background: var(--wk-surface);
    color: var(--wk-text);
    box-shadow: var(--wk-shadow-xs);
}
body.wk-evui .error { border-left-color: var(--wk-danger); background: var(--wk-danger-soft); color: var(--wk-text); }
body.wk-evui .success { border-left-color: var(--wk-success); background: var(--wk-success-soft); color: var(--wk-text); }
body.wk-evui .warning { border-left-color: var(--wk-warning); background: var(--wk-warning-soft); color: var(--wk-text); }
body.wk-evui .jquery-notify-bar {
    width: min(calc(100% - 20px), 680px);
    top: 10px;
    left: 50%;
    padding: 10px 42px 10px 12px;
    border: 1px solid var(--wk-border);
    border-radius: var(--wk-radius);
    background: var(--wk-surface-raised);
    color: var(--wk-text);
    font-family: var(--wk-font);
    font-size: 13px;
    text-align: left;
    text-shadow: none;
    box-shadow: var(--wk-shadow-lg);
    opacity: 1;
    transform: translateX(-50%);
}
body.wk-evui .jquery-notify-bar.error,
body.wk-evui .jquery-notify-bar.fail { background: var(--wk-danger-soft); color: var(--wk-text); }
body.wk-evui .jquery-notify-bar.success { background: var(--wk-success-soft); color: var(--wk-text); }
body.wk-evui .notify-bar-close { right: 12px; left: auto; color: var(--wk-muted); }

/* Login */
body.wk-evui.login #wrap {
    display: grid;
    min-height: calc(100dvh - 46px);
    place-content: center;
}
body.wk-evui.login header[role="banner"] { justify-content: center; }
body.wk-evui.login .wk-evui-toolbar { position: fixed; top: 12px; right: 12px; }
body.wk-evui.login .wk-evui-brand-caption { max-width: min(90vw, 420px); justify-content: center; }
body.wk-evui.login main,
body.wk-evui.login #login {
    width: min(100%, 360px);
    max-width: 360px;
    margin: 0;
}
body.wk-evui.login main {
    padding: 16px;
    border: 1px solid var(--wk-border);
    border-radius: var(--wk-radius-lg);
    background: var(--wk-surface);
    box-shadow: var(--wk-shadow-sm);
}
body.wk-evui.login #login p { color: var(--wk-text); font-weight: 620; }
body.wk-evui.login #login ul { padding: 0; list-style: none; }
body.wk-evui.login #login ul li { padding: 5px 0; background: none; }

/* Dialog */
body.wk-evui dialog,
body.wk-evui #delete-confirm-dialog {
    width: min(calc(100vw - 24px), 480px);
    height: auto;
    max-height: min(86dvh, 620px);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--wk-border);
    border-radius: var(--wk-radius-lg);
    background: var(--wk-surface-raised);
    color: var(--wk-text);
    box-shadow: var(--wk-shadow-lg);
}
body.wk-evui dialog::backdrop,
body.wk-evui #delete-confirm-dialog::backdrop { background: var(--wk-overlay); backdrop-filter: blur(3px); }
body.wk-evui #delete-confirm-dialog > div[name="dialog_title"],
body.wk-evui dialog [name="dialog_title"] {
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid var(--wk-border);
    border-radius: 0;
    background: var(--wk-surface-raised);
    color: var(--wk-text-strong);
    font-size: 15px;
    font-weight: 740;
    text-align: left;
}
body.wk-evui #delete-confirm-dialog div.confirm-message,
body.wk-evui dialog .confirm-message {
    width: auto;
    height: auto;
    max-height: 55dvh;
    float: none;
    padding: 14px;
    overflow: auto;
    background: var(--wk-surface-raised);
    color: var(--wk-text);
    text-align: left;
}
body.wk-evui #delete-confirm-dialog div.confirm-message ul {
    margin: 0;
    padding: 0 0 0 14px;
    border-left: 2px solid var(--wk-accent);
    list-style: none;
}
body.wk-evui #delete-confirm-dialog div.confirm-message ul li span {
    border-color: var(--wk-border);
    background: var(--wk-surface-soft);
    color: var(--wk-text);
}
body.wk-evui #delete-confirm-dialog div.button-group,
body.wk-evui dialog .button-group {
    display: flex;
    width: auto;
    height: auto;
    float: none;
    justify-content: flex-end;
    gap: 7px;
    padding: 10px 14px;
    border-top: 1px solid var(--wk-border);
    border-radius: 0;
    background: var(--wk-surface-soft);
}

/* Statistics, tabs and charts */
body.wk-evui #tabs,
body.wk-evui .wrap_unfloat { min-width: 0; overflow: visible; }
body.wk-evui #tabs ul#headers {
    display: flex;
    float: none;
    gap: 3px;
    margin: 0 0 8px;
    padding: 4px;
    overflow-x: auto;
    border: 1px solid var(--wk-border);
    border-radius: 9px;
    background: var(--wk-surface);
    list-style: none;
}
body.wk-evui #tabs ul#headers li,
body.wk-evui #tabs ul#headers li h2,
body.wk-evui #stats_lines li {
    display: block;
    margin: 0;
}
body.wk-evui #tabs ul#headers li a,
body.wk-evui #stats_lines li a {
    display: block;
    padding: 7px 9px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--wk-muted);
    font-size: 12px;
    font-weight: 640;
    white-space: nowrap;
}
body.wk-evui #tabs ul#headers li a:hover,
body.wk-evui #stats_lines li a:hover { background: var(--wk-surface-hover); color: var(--wk-text-strong); }
body.wk-evui #tabs ul#headers li a.selected,
body.wk-evui #tabs ul#headers li a.selected:hover,
body.wk-evui #stats_lines li a.selected,
body.wk-evui #stats_lines li a.selected:hover {
    border: 0;
    background: var(--wk-accent);
    color: var(--wk-accent-contrast);
}
body.wk-evui #tabs ul#headers h2 { margin: 0; color: inherit; font-size: inherit; letter-spacing: 0; }
body.wk-evui .tab {
    padding: 12px;
    overflow: hidden;
    border: 1px solid var(--wk-border);
    border-radius: var(--wk-radius);
    background: var(--wk-surface);
    color: var(--wk-text);
    box-shadow: var(--wk-shadow-xs);
}
body.wk-evui ul.toggle_display {
    margin: 0 0 8px;
    padding: 8px;
    border: 1px solid var(--wk-border);
    border-radius: var(--wk-radius-sm);
    background: var(--wk-surface-soft);
}
body.wk-evui #historical_clicks li:hover { background: var(--wk-accent-soft) !important; }
body.wk-evui :where([id^="chart"], .google-visualization-table, .google-visualization-table-table) {
    max-width: 100%;
    overflow-x: auto;
    background: transparent !important;
    color: var(--wk-text) !important;
}
:root[data-wk-theme="dark"] body.wk-evui [id^="chart"] svg text { fill: var(--wk-text) !important; }
:root[data-wk-theme="dark"] body.wk-evui [id^="chart"] svg rect[fill="#ffffff"],
:root[data-wk-theme="dark"] body.wk-evui [id^="chart"] svg rect[fill="white"] { fill: var(--wk-surface) !important; }
:root[data-wk-theme="dark"] body.wk-evui .google-visualization-table-table :where(td, th) {
    border-color: var(--wk-border) !important;
    background: var(--wk-surface) !important;
    color: var(--wk-text) !important;
}

/* Quick share */
body.wk-evui #shareboxes,
body.wk-evui #tweet { overflow: visible; }
body.wk-evui #shareboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 8px;
    margin-top: 10px;
}
body.wk-evui div.share {
    width: auto;
    height: auto;
    min-height: 0;
    float: none;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--wk-border);
    border-radius: var(--wk-radius);
    background: var(--wk-surface);
    color: var(--wk-text);
}
body.wk-evui #copybox,
body.wk-evui #sharebox,
body.wk-evui #tweet_body { width: 100%; }
body.wk-evui #tweet_body { float: none; min-height: 86px; font-size: 13px; }
body.wk-evui #charcount { color: var(--wk-muted); }
body.wk-evui #charcount.negative { color: var(--wk-danger); }

/* Calendar */
body.wk-evui .datepicker {
    width: 232px;
    border: 1px solid var(--wk-border);
    border-collapse: separate;
    border-radius: var(--wk-radius);
    background: var(--wk-surface-raised);
    box-shadow: var(--wk-shadow-lg);
}
body.wk-evui .datepicker :where(th, tfoot td) {
    background: var(--wk-surface-soft);
    color: var(--wk-muted);
    font-family: var(--wk-font);
}
body.wk-evui .datepicker tbody td {
    width: 30px;
    height: 30px;
    border-color: var(--wk-border);
    background: var(--wk-surface);
    color: var(--wk-text);
    font-family: var(--wk-font);
}
body.wk-evui .datepicker tbody td.date.over { background: var(--wk-accent-soft); }
body.wk-evui .datepicker tbody td.date.chosen { background: var(--wk-accent); color: #fff; }

/* Plugin management and unknown plugin pages */
body.wk-evui tr.plugin.active td { background: var(--wk-success-soft); }
body.wk-evui tr.plugin.active a { font-weight: 720; }
body.wk-evui.desktop tr.plugin td.plugin_desc small,
body.wk-evui tr:hover.plugin td.plugin_desc small { visibility: visible; color: var(--wk-muted); }
body.wk-evui fieldset {
    margin: 10px 0;
    padding: 11px;
    border: 1px solid var(--wk-border);
    border-radius: var(--wk-radius);
    background: var(--wk-surface);
}
body.wk-evui legend { padding: 0 5px; color: var(--wk-text-strong); font-weight: 680; }
body.wk-evui a.bookmarklet {
    margin: 3px;
    padding: 7px 10px;
    border: 1px solid var(--wk-border-strong);
    border-radius: var(--wk-radius-sm);
    background: var(--wk-surface);
    color: var(--wk-text);
}
body.wk-evui a.bookmarklet:hover { background: var(--wk-surface-hover); text-decoration: none; }
body.wk-evui .sub_wrap span { background: var(--wk-warning-soft); color: var(--wk-text); }

/* Evergreen settings */
.wk-evui-settings-page { display: grid; gap: 10px; }
.wk-evui-page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 1px 0 3px;
}
.wk-evui-page-heading p { margin: 3px 0 0; }
.wk-evui-eyebrow {
    margin: 0 0 4px !important;
    color: var(--wk-accent-hover) !important;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
}
.wk-evui-version {
    padding: 3px 7px;
    border: 1px solid var(--wk-border);
    border-radius: 999px;
    background: var(--wk-surface);
    color: var(--wk-muted);
    font-family: var(--wk-mono);
    font-size: 10px;
}
.wk-evui-recovery-note { margin: -4px 0 2px; color: var(--wk-muted); font-size: 11px; }
.wk-evui-settings-card {
    padding: 12px;
    border: 1px solid var(--wk-border);
    border-radius: var(--wk-radius);
    background: var(--wk-surface);
    box-shadow: var(--wk-shadow-xs);
}
.wk-evui-card-heading {
    display: grid;
    grid-template-columns: minmax(130px, .26fr) minmax(200px, 1fr);
    gap: 14px;
    margin-bottom: 10px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--wk-border);
}
.wk-evui-card-heading :where(h3, p) { margin: 0; }
.wk-evui-card-heading h3 { font-size: 14px; }
.wk-evui-card-heading p { font-size: 12px; }
.wk-evui-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.wk-evui-field { display: flex; min-width: 0; flex-direction: column; gap: 5px; color: var(--wk-text); font-weight: 640; }
.wk-evui-field > span:first-child { color: var(--wk-muted); font-size: 11px; }
.wk-evui-field-wide { grid-column: 1 / -1; }
.wk-evui-color-field { display: flex; align-items: center; gap: 8px; }
.wk-evui-color-field code { color: var(--wk-muted); font-size: 11px; }
.wk-evui-check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
.wk-evui-check {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 8px;
    border: 1px solid var(--wk-border);
    border-radius: var(--wk-radius-sm);
    background: var(--wk-surface-soft);
    color: var(--wk-text);
    font-size: 12px;
    font-weight: 580;
}
.wk-evui-check input { flex: 0 0 auto; margin-top: 1px; }
.wk-evui-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.wk-evui-form-actions > span { color: var(--wk-muted); font-size: 11px; }
.wk-evui-local-notice {
    padding: 9px 10px;
    border: 1px solid var(--wk-border);
    border-left: 3px solid var(--wk-success);
    border-radius: var(--wk-radius-sm);
    background: var(--wk-surface);
    color: var(--wk-text);
}
.wk-evui-local-notice.is-error { border-left-color: var(--wk-danger); }
.wk-evui-status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; margin-bottom: 9px; }
.wk-evui-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--wk-muted); }
.wk-evui-status-dot.is-on { background: var(--wk-success); }
.wk-evui-status-row code { max-width: 100%; color: var(--wk-muted); overflow-wrap: anywhere; }
.wk-evui-danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px;
    border: 1px dashed color-mix(in srgb, var(--wk-danger) 45%, var(--wk-border));
    border-radius: var(--wk-radius);
    background: var(--wk-danger-soft);
}
.wk-evui-danger-zone > div { display: flex; flex-direction: column; }
.wk-evui-danger-zone span { color: var(--wk-muted); font-size: 11px; }

/* Footer and toast */
body.wk-evui #footer { padding: 8px var(--wk-page-pad) 18px; color: var(--wk-muted); font-size: 11px; text-align: center; }
body.wk-evui #footer p {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}
body.wk-evui #footer p a { padding: 0; background: none; }
.wk-evui-footer-brand { color: var(--wk-text); font-weight: 680; }
.wk-evui-toast {
    position: fixed;
    z-index: 99999;
    right: 14px;
    bottom: 14px;
    max-width: min(340px, calc(100vw - 28px));
    padding: 9px 11px;
    border: 1px solid var(--wk-border);
    border-radius: 8px;
    background: var(--wk-text-strong);
    color: var(--wk-surface);
    font-size: 12px;
    font-weight: 650;
    box-shadow: var(--wk-shadow-lg);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease;
}
.wk-evui-toast.is-visible { opacity: 1; transform: translateY(0); }
.wk-evui-toast[data-type="error"] { background: var(--wk-danger); color: #fff; }

/* Compatibility mode: only horizontal table safety, no DOM-dependent card conversion. */
body.wk-evui.wk-compat-safe table { min-width: max-content; }
body.wk-evui.wk-compat-safe .wk-evui-table-scroll { overflow-x: auto; }

/* Responsive behavior */
@media (max-width: 1040px) {
    .wk-evui-check-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 840px) {
    :root { --wk-page-pad: 10px; --wk-section-gap: 10px; }
    body.wk-evui header[role="banner"] { min-height: 52px; padding: 7px 0; }
    .wk-evui-menu-toggle { display: inline-grid; }
    body.wk-evui nav[role="navigation"] {
        position: fixed;
        z-index: 100;
        top: 58px;
        right: 10px;
        left: 10px;
        display: none;
        max-height: calc(100dvh - 70px);
        margin: 0;
        padding: 6px;
        overflow-y: auto;
        border-radius: 11px;
        background: var(--wk-surface-raised);
        box-shadow: var(--wk-shadow-lg);
        backdrop-filter: none;
    }
    body.wk-evui.wk-menu-open { overflow: hidden; }
    body.wk-evui.wk-menu-open nav[role="navigation"] { display: block; }
    body.wk-evui #admin_menu { display: block; }
    body.wk-evui #admin_menu > li,
    body.wk-evui #admin_menu_logout_link { margin: 0 !important; padding: 0 !important; }
    body.wk-evui #admin_menu a { padding: 10px; font-size: 14px; }
    body.wk-evui #admin_menu_logout_link { padding: 9px 10px !important; border-top: 1px solid var(--wk-border); }
    body.wk-evui #admin_menu > li > ul {
        position: static;
        display: block;
        min-width: 0;
        margin: 0 0 4px 9px;
        padding: 0 0 0 7px;
        border: 0;
        border-left: 1px solid var(--wk-border);
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transform: none;
        transition: none;
    }
    body.wk-evui #admin_menu > li > ul::before { display: none; }
    body.wk-evui #admin_menu ul a { padding: 8px; color: var(--wk-muted); font-size: 13px; }
    .wk-evui-card-heading { grid-template-columns: 1fr; gap: 3px; }
    .wk-evui-field-grid { grid-template-columns: 1fr; }
    .wk-evui-field-wide { grid-column: auto; }
    .wk-evui-check-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    /* 16px inputs prevent automatic iOS Safari zoom. Controls stay touch sized. */
    body.wk-evui :where(
        input:not([type]), input[type="text"], input[type="url"], input[type="email"], input[type="password"],
        input[type="tel"], input[type="number"], input[type="search"], input[type="date"], input[type="time"],
        input[type="month"], input[type="week"], input[type="datetime-local"], select, textarea
    ) {
        min-height: 44px;
        padding: 9px 11px;
        font-size: 16px;
    }
    body.wk-evui :where(.button, button, input.button, input[type="button"], input[type="submit"], input[type="reset"]) {
        min-height: 42px;
        font-size: 14px;
    }
    body.wk-evui #filter_form { margin-bottom: 8px; }
    body.wk-evui .wk-filter-toggle { display: flex; }
    body.wk-evui #filter_form.wk-filter-collapsed { padding: 7px; }
    body.wk-evui #filter_form.wk-filter-collapsed > form { display: none; }
    body.wk-evui #filter_form.wk-filter-collapsed .wk-filter-toggle { background: transparent; }
    body.wk-evui #filter_form:not(.wk-filter-collapsed) .wk-filter-toggle { margin-bottom: 9px; }
    body.wk-evui #filter_form #filter_options.wk-filter-enhanced {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    body.wk-evui #filter_form .wk-filter-wide,
    body.wk-evui #filter_buttons { grid-column: 1 / -1; }
    body.wk-evui #filter_buttons { justify-content: stretch; }
    body.wk-evui #filter_buttons > :where(input, button) { flex: 1 1 0; width: auto; }

    /* The main URL table becomes a deliberate card collection. Other tables remain scrollable tables. */
    body.wk-evui.wk-compat-enhanced.wk-table-cards .wk-card-table-scroll {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table,
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody {
        display: block;
        width: 100%;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody {
        display: grid;
        gap: 8px;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr:not(.edit-row) {
        display: grid;
        grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) minmax(58px, .55fr);
        grid-template-areas:
            "keyword keyword keyword"
            "url url url"
            "timestamp ip clicks"
            "actions actions actions";
        width: 100%;
        min-width: 0;
        overflow: hidden;
        border: 1px solid var(--wk-border);
        border-radius: var(--wk-radius);
        background: var(--wk-surface);
        box-shadow: var(--wk-shadow-xs);
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr:not(.edit-row):hover {
        border-color: var(--wk-border-strong);
        background: var(--wk-surface);
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr:not(.edit-row) > td {
        display: block;
        width: auto;
        min-width: 0;
        padding: 8px 10px;
        border: 0;
        background: transparent !important;
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr:not(.edit-row) > td::before {
        content: attr(data-label);
        display: block;
        margin: 0 0 2px;
        color: var(--wk-muted);
        font-size: 10px;
        font-weight: 760;
        line-height: 1.25;
        letter-spacing: .045em;
        text-transform: uppercase;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table td.keyword {
        grid-area: keyword;
        padding-bottom: 7px;
        border-bottom: 1px solid var(--wk-border);
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table td.keyword a {
        display: inline-block;
        max-width: 100%;
        font-size: 15px;
        font-weight: 740;
        line-height: 1.3;
        overflow-wrap: anywhere;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table td.url {
        grid-area: url;
        padding-top: 8px;
        padding-bottom: 9px;
        border-bottom: 1px solid var(--wk-border);
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table td.url > a:first-child {
        display: -webkit-box;
        overflow: hidden;
        color: var(--wk-text-strong);
        font-size: 14px;
        font-weight: 650;
        line-height: 1.35;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table td.url > br { display: none; }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table td.url small {
        display: block;
        margin-top: 4px;
        line-height: 1.35;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table td.url small a {
        display: -webkit-box;
        overflow: hidden;
        font-size: 12px;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table td.timestamp {
        grid-area: timestamp;
        border-right: 1px solid var(--wk-border);
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table td.ip {
        grid-area: ip;
        border-right: 1px solid var(--wk-border);
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table td.clicks {
        grid-area: clicks;
        text-align: left;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table :where(td.timestamp, td.ip, td.clicks) {
        min-height: 55px;
        font-size: 13px;
        line-height: 1.3;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr:not(.edit-row) > td:not(.keyword, .url, .timestamp, .ip, .clicks, .actions) {
        grid-column: 1 / -1;
        border-top: 1px solid var(--wk-border);
    }

    /* Actions are always one compact, touch-friendly horizontal toolbar. */
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr:not(.edit-row) > td.actions {
        grid-area: actions;
        display: flex !important;
        width: 100% !important;
        min-width: 0 !important;
        min-height: 0;
        align-items: center;
        justify-content: center;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        padding: 9px 10px 10px !important;
        overflow-x: auto;
        overflow-y: hidden;
        border-top: 1px solid var(--wk-border) !important;
        background: var(--wk-surface-soft) !important;
        white-space: nowrap !important;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr:not(.edit-row) > td.actions.wk-many-actions {
        justify-content: flex-start;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr:not(.edit-row) > td.actions::-webkit-scrollbar { display: none; }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr:not(.edit-row) > td.actions::before { display: none !important; }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr:not(.edit-row) > td.actions > :where(a.button, button.button, input.button) {
        --wk-action-icon-size: 18px;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        vertical-align: middle !important;
        float: none !important;
        clear: none !important;
        flex: 0 0 42px !important;
        width: 42px !important;
        min-width: 42px !important;
        max-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        margin: 0 !important;
        padding: 0 !important;
        border-color: var(--wk-border) !important;
        border-radius: 10px;
        background-color: var(--wk-surface) !important;
        box-shadow: var(--wk-shadow-xs);
        line-height: 0 !important;
        font-size: 0 !important;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr:not(.edit-row) > td.actions > :where(a.button, button.button, input.button):hover,
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr:not(.edit-row) > td.actions > :where(a.button, button.button, input.button):focus-visible {
        border-color: var(--wk-border-strong) !important;
        background-color: var(--wk-surface-hover) !important;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr:not(.edit-row) > td.actions > input[type="hidden"] { display: none !important; }

    /* Keep inline editing compact and usable instead of treating it as a data card. */
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr.edit-row {
        display: block;
        width: 100%;
        overflow: hidden;
        border: 1px solid color-mix(in srgb, var(--wk-accent) 38%, var(--wk-border));
        border-radius: var(--wk-radius);
        background: var(--wk-surface);
        box-shadow: var(--wk-shadow-xs);
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr.edit-row > td {
        display: block !important;
        width: 100% !important;
        padding: 9px 10px !important;
        border: 0 !important;
        background: transparent !important;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr.edit-row > td::before { display: none !important; }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr.edit-row > td.edit-row strong {
        display: block;
        margin-top: 5px;
        color: var(--wk-muted);
        font-size: 11px;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr.edit-row > td.edit-row br { display: none; }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr.edit-row > td.edit-row input.text {
        width: 100% !important;
        margin: 3px 0 4px;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr.edit-row > td:last-child {
        display: flex !important;
        gap: 7px;
        padding-top: 0 !important;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr.edit-row > td:last-child > :where(input.button, button.button) {
        flex: 1 1 0;
        margin: 0 !important;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr.edit-row > td:last-child > input[type="hidden"] { display: none; }

    /* The real YOURLS filter and pagination live in tfoot; never hide them on phones. */
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tfoot,
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tfoot > tr,
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tfoot > tr > th {
        position: static;
        display: block;
        width: 100%;
        height: auto;
        overflow: visible;
        clip: auto;
        clip-path: none;
        white-space: normal;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tfoot {
        margin-top: 9px;
        border: 1px solid var(--wk-border);
        border-radius: var(--wk-radius);
        background: var(--wk-surface);
        box-shadow: var(--wk-shadow-xs);
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tfoot > tr {
        background: transparent !important;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tfoot > tr > th {
        padding: 9px !important;
        border: 0 !important;
        background: transparent !important;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tfoot #filter_form {
        margin: 0 0 8px;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tfoot #pagination {
        margin: 0;
        padding-top: 8px;
        border-top: 1px solid var(--wk-border);
    }

    .wk-evui-page-heading,
    .wk-evui-danger-zone { align-items: stretch; flex-direction: column; }
}

@media (max-width: 480px) {
    .wk-evui-brand-caption { max-width: calc(100vw - 104px); }
    .wk-evui-brand-copy > span { display: none; }
    body.wk-evui #yourls-logo { width: 88px; }
    body.wk-evui #delete-confirm-dialog div.button-group,
    body.wk-evui dialog .button-group { flex-direction: column-reverse; }
    body.wk-evui #delete-confirm-dialog div.button-group > *,
    body.wk-evui dialog .button-group > * { width: 100%; }
    .wk-evui-form-actions { align-items: stretch; flex-direction: column; }
    .wk-evui-form-actions > :where(button, form) { width: 100%; }
    .wk-evui-form-actions form > button { width: 100%; }
}

@media (max-width: 360px) {
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table tbody > tr:not(.edit-row) {
        grid-template-columns: minmax(0, 1fr) minmax(64px, .58fr);
        grid-template-areas:
            "keyword keyword"
            "url url"
            "timestamp timestamp"
            "ip clicks"
            "actions actions";
    }
    body.wk-evui.wk-compat-enhanced.wk-table-cards table.wk-card-table td.timestamp {
        border-right: 0;
        border-bottom: 1px solid var(--wk-border);
    }
}

@media (prefers-reduced-motion: reduce) {
    body.wk-evui *, body.wk-evui *::before, body.wk-evui *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media print {
    body.wk-evui { background: #fff; color: #000; }
    body.wk-evui nav,
    .wk-evui-toolbar,
    body.wk-evui #new_url,
    body.wk-evui #footer,
    body.wk-evui .button,
    .wk-evui-toast { display: none !important; }
    body.wk-evui #wrap { width: 100%; max-width: none; padding: 0; }
    body.wk-evui .wk-evui-table-scroll,
    body.wk-evui table,
    body.wk-evui .tab { border: 0; box-shadow: none; }
}
