/* ============================================================
   YOURLS UIkit Skin
   Modern admin re-skin built on UIkit 3.
   ============================================================ */

:root {
    --sb-accent: #1e87f0;
    --sb-bg: #f6f8fb;
    --sb-card-bg: #ffffff;
    --sb-border: #e5e9f0;
    --sb-text: #1f2937;
    --sb-text-muted: #6b7280;
    --sb-radius: 10px;
    --sb-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.04);
    --sb-shadow-lg: 0 4px 6px rgba(15, 23, 42, 0.04), 0 12px 32px rgba(15, 23, 42, 0.08);
}

/* ---------- Base reset of YOURLS defaults ---------- */

html, body {
    background: var(--sb-bg) !important;
    color: var(--sb-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
}

/* Hide the original H1 logo + tagline – the navbar replaces it */
#wrap > h1,
h1#logo,
#wrap > p:first-of-type,
body > h1:first-of-type,
img#yourls-logo {
    display: none !important;
}

/* The default YOURLS layout has #wrap with weird widths. Make it full-width and let inner elements constrain themselves. */
#wrap {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
}

#wrap p:nth-of-type(2), #wrap p:nth-of-type(3) {
    text-align: center;
}

/* The page content (everything after the logo) sits inside <main> */
#wrap > main,
body > main {
    display: block;
    max-width: 1680px;
    margin: 0 auto !important;
    padding: 32px !important;
    box-sizing: border-box;
}

/* Original admin_menu (top tab bar) — hide it, we use the navbar */
#admin_menu,
ul#admin_menu_logout_link {
    display: none !important;
}

/* ---------- Navbar ---------- */

.sb-navbar {
    background: #ffffff;
    box-shadow: var(--sb-shadow);
    border-bottom: 1px solid var(--sb-border);
    position: sticky;
    top: 0;
    z-index: 980;
    padding: 0 32px;
}

.sb-navbar-inner {
    max-width: 1680px;
    margin: 0 auto;
    background: transparent !important;
    box-shadow: none !important;
}

.sb-navbar-inner.uk-navbar-container:not(.uk-navbar-transparent) {
    background: transparent !important;
}

.sb-navbar .uk-navbar-nav > li > a {
    color: var(--sb-text);
    font-weight: 500;
    text-transform: none;
    min-height: 64px;
    font-size: 14px;
    gap: 6px;
}

.sb-navbar .uk-navbar-nav > li.uk-active > a,
.sb-navbar .uk-navbar-nav > li > a:hover {
    color: var(--sb-accent);
}

.sb-navbar .uk-navbar-nav > li.uk-active > a {
    box-shadow: inset 0 -3px 0 var(--sb-accent);
}

.sb-brand-logo {
    display: block;
    width: 154px;
    height: auto;
    max-height: 52px;
    object-fit: contain;
}

.sb-username {
    margin-left: 8px;
    font-weight: 500;
}

.sb-admin-nav {
    position: relative;
}

.sb-admin-chevron {
    width: 7px;
    height: 7px;
    margin: -4px 0 0 3px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform .15s ease;
}

.sb-admin-toggle[aria-expanded="true"] .sb-admin-chevron {
    margin-top: 3px;
    transform: rotate(225deg);
}

.sb-admin-dropdown[hidden] {
    display: none !important;
}

.sb-admin-dropdown {
    position: absolute;
    top: 58px;
    left: 0;
    z-index: 1100;
    box-sizing: border-box;
    width: 310px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--sb-border);
    border-radius: 14px;
    box-shadow: var(--sb-shadow-lg);
}

.sb-dropdown-heading {
    padding: 4px 10px 10px;
    color: var(--sb-text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.sb-admin-dropdown .uk-nav > li > a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    color: var(--sb-text);
    border-radius: 9px;
}

.sb-admin-dropdown .uk-nav > li > a:hover {
    color: var(--sb-accent);
    background: #f1f7fd;
}

.sb-admin-dropdown .sb-menu-icon {
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    color: #486171;
    background: #f7fafc;
    border: 1px solid #e4ebf1;
    border-radius: 9px;
}

.sb-admin-dropdown strong,
.sb-admin-dropdown small {
    display: block;
}

.sb-admin-dropdown strong {
    color: inherit;
    font-size: 13px;
    font-weight: 650;
}

.sb-admin-dropdown small {
    margin-top: 1px;
    color: var(--sb-text-muted);
    font-size: 11px;
}

.sb-admin-dropdown .uk-nav-divider {
    margin: 8px 10px;
}

.sb-icon-link {
    min-width: 48px;
}

.sb-password-wrap {
    position: relative;
    display: block;
    width: 100%;
}

.sb-password-wrap input {
    box-sizing: border-box;
    width: 100% !important;
    padding-right: 82px !important;
}

.sb-password-toggle {
    position: absolute;
    top: 50%;
    right: 9px;
    z-index: 2;
    padding: 5px 7px;
    color: #0f766e;
    background: transparent;
    border: 0;
    box-shadow: none;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    transform: translateY(-50%);
}

.sb-password-toggle:hover { color: #075c56; }

body.login .sig4-login-help {
    margin: -5px 0 0 !important;
    text-align: center;
}

body.login .sig4-login-help a {
    color: #0f766e;
    font-size: .9rem;
    font-weight: 800;
    text-decoration: none;
}

body.login .sig4-login-help a:hover { text-decoration: underline; }

.sb-navbar .uk-navbar-nav > li > a.sb-logout-link {
    min-height: 64px;
    margin: 0 0 0 4px;
    padding: 0 12px;
    color: #405866;
    background: transparent;
    border: 0;
    border-radius: 0;
    font-size: 13px;
    font-weight: 600;
}

.sb-navbar .uk-navbar-nav > li > a.sb-logout-link:hover {
    color: #b4232f;
    background: transparent;
}

.sb-mobile-brand {
    margin: 4px 0 22px;
    color: #fff;
    font-size: 23px;
    font-weight: 750;
}

/* ---------- Individual link statistics ---------- */

body.infos .sig4-infos-main {
    width: min(1480px, calc(100% - 48px));
    margin: 30px auto 56px;
}

body.infos .sig4-link-summary,
body.infos #tabs {
    box-sizing: border-box;
    background: #fff;
    border: 1px solid var(--sb-border);
    border-radius: 18px;
    box-shadow: var(--sb-shadow);
}

body.infos .sig4-link-summary {
    padding: 24px 28px;
    margin-bottom: 22px;
}

body.infos .sig4-link-summary-heading {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

body.infos .sig4-link-summary-icon {
    display: grid;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    place-items: center;
    color: #087b99;
    background: #e8f8fb;
    border-radius: 11px;
    font-size: 21px;
    font-weight: 700;
}

body.infos .sig4-eyebrow {
    display: block;
    margin-bottom: 3px;
    color: var(--sb-text-muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

body.infos h2#informations {
    margin: 0;
    color: #10283b;
    font-size: clamp(20px, 2vw, 28px);
    line-height: 1.2;
}

body.infos .sig4-link-summary-grid {
    display: grid;
    grid-template-columns: minmax(240px, .7fr) minmax(0, 1.3fr);
    gap: 14px;
}

body.infos .sig4-link-detail {
    min-width: 0;
    padding: 13px 15px;
    background: #f7fafc;
    border: 1px solid #e5edf2;
    border-radius: 11px;
}

body.infos .sig4-link-detail > .label {
    display: block;
    width: auto;
    margin-bottom: 5px;
    color: #607585;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .06em;
    text-transform: uppercase;
}

body.infos .sig4-link-detail-value {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: #0a6173;
    font-size: 14px;
    font-weight: 650;
}

body.infos .sig4-link-detail-value img {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
}

body.infos .sig4-link-detail-value a {
    max-width: 100%;
    overflow: hidden;
    color: #087b99;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.infos #tabs {
    overflow: hidden;
}

body.infos #tabs .wrap_unfloat {
    overflow-x: auto;
    border-bottom: 1px solid var(--sb-border);
}

body.infos #tabs ul#headers {
    display: flex !important;
    float: none;
    min-width: max-content;
    margin: 0;
    padding: 0 18px;
    border: 0;
}

body.infos #tabs ul#headers li {
    display: block;
    margin: 0;
}

body.infos #tabs ul#headers li a {
    display: block;
    padding: 17px 16px 14px;
    color: #607585;
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    text-decoration: none;
}

body.infos #tabs ul#headers li a:hover,
body.infos #tabs ul#headers li a.selected {
    color: #087b99;
    background: transparent;
    border-bottom-color: #15b7c5;
}

body.infos #tabs ul#headers h2 {
    display: block;
    margin: 0;
    color: inherit;
    font-size: 13px;
    font-weight: 700;
}

body.infos #tabs > .tab {
    padding: 26px;
}

body.infos .tab > table {
    display: block;
    width: 100%;
}

body.infos .tab > table > tbody,
body.infos .tab > table > tbody > tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    width: 100%;
}

body.infos .tab > table > tbody > tr > td {
    display: block;
    box-sizing: border-box;
    min-width: 0;
    padding: 22px;
    background: #f9fbfc;
    border: 1px solid #e5edf2;
    border-radius: 14px;
}

body.infos .tab h3 {
    color: #243f52;
    font-size: 15px;
}

body.infos .stats_line,
body.infos [id^="visualization_"] {
    max-width: 100%;
    overflow-x: auto;
}

body.infos #visualization_stat_tab_location_map,
body.infos #visualization_stat_tab_location_pie {
    min-height: 260px;
}

body.infos #stats_lines {
    display: flex !important;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0 0 18px;
    padding: 0;
}

body.infos #stats_lines li { margin: 0; }
body.infos #stats_lines li a {
    display: block;
    padding: 7px 11px;
    color: #526b7a;
    background: #fff;
    border: 1px solid #d8e4eb;
    border-radius: 8px;
    font-size: 12px;
}

body.infos #stats_lines li a.selected {
    color: #087b99;
    background: #eaf9fb;
    border-color: #91dce3;
}

body.infos #historical_clicks li {
    margin: 0 0 5px;
    padding: 8px 10px;
    background: #fff !important;
    border: 1px solid #e6edf2;
    border-radius: 8px;
}

body.infos #stat_tab_share #shareboxes {
    max-width: 100%;
}

@media (max-width: 800px) {
    body.infos .sig4-infos-main { width: min(100% - 24px, 1480px); margin-top: 16px; }
    body.infos .sig4-link-summary { padding: 19px; }
    body.infos .sig4-link-summary-grid,
    body.infos .tab > table > tbody,
    body.infos .tab > table > tbody > tr { grid-template-columns: 1fr; }
    body.infos #tabs > .tab { padding: 16px; }
    body.infos .tab > table > tbody > tr > td { padding: 16px; }
}

/* ---------- Administration pages ---------- */

.sig4-admin-page,
body.plugin_page_db_users #wrap > h2,
body.plugin_page_db_users #wrap > h3,
body.plugin_page_db_users #wrap > form,
body.plugin_page_db_users #wrap > table,
body.plugin_page_db_users #wrap > .notice,
body.plugin_page_db_users #wrap > .success,
body.plugin_page_db_users #wrap > .error {
    box-sizing: border-box;
    width: min(1180px, calc(100% - 48px));
    margin-right: auto !important;
    margin-left: auto !important;
}

.sig4-admin-page {
    margin-top: 30px;
    margin-bottom: 50px;
    padding: 0 !important;
}

.sig4-admin-heading {
    margin-bottom: 20px;
}

.sig4-admin-heading > span {
    display: block;
    margin-bottom: 4px;
    color: #087b99;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.sig4-admin-heading h2,
body.plugin_page_db_users #wrap > h2 {
    margin-top: 0;
    margin-bottom: 5px;
    color: #10283b;
    font-size: 26px;
    line-height: 1.2;
}

.sig4-admin-heading p {
    margin: 0;
    color: var(--sb-text-muted);
}

.sig4-admin-card,
body.plugin_page_db_users .db-users-form {
    box-sizing: border-box;
    padding: 22px !important;
    background: #fff !important;
    border: 1px solid var(--sb-border) !important;
    border-radius: 14px !important;
    box-shadow: var(--sb-shadow) !important;
}

.sig4-settings-form {
    max-width: 680px;
}

.sig4-settings-form p {
    margin: 0 0 18px;
}

.sig4-settings-form p:last-child {
    margin-bottom: 0;
}

.sig4-settings-form label,
body.plugin_page_db_users .db-users-form label {
    display: block;
    margin-bottom: 6px;
    color: #304b5c;
    font-size: 13px;
    font-weight: 700;
}

.sig4-settings-form label + small {
    display: block;
    margin: -3px 0 10px;
    color: var(--sb-text-muted);
    font-size: 12px;
}

.sig4-settings-form textarea,
.sig4-settings-form input[type="number"],
body.plugin_page_db_users .db-users-form input,
body.plugin_page_db_users .db-users-form select {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    color: var(--sb-text);
    background: #fff;
    border: 1px solid #cfdae2;
    border-radius: 8px;
    font: inherit;
}

.sig4-settings-form textarea {
    min-height: 190px;
    resize: vertical;
}

.sig4-settings-form input[type="number"] {
    width: 150px;
}

.sig4-settings-form textarea:focus,
.sig4-settings-form input:focus,
body.plugin_page_db_users .db-users-form input:focus,
body.plugin_page_db_users .db-users-form select:focus {
    outline: none;
    border-color: var(--sb-accent);
    box-shadow: 0 0 0 3px rgba(30, 135, 240, .12);
}

/* User accounts: turn the direct plugin output into a coherent workspace. */
body.plugin_page_db_users #wrap > h2 {
    margin-top: 30px !important;
}

body.plugin_page_db_users #wrap > h3 {
    margin-top: 24px !important;
    margin-bottom: 10px !important;
    color: #304b5c;
    font-size: 15px;
}

body.plugin_page_db_users .db-users-form {
    max-width: 680px !important;
    margin-bottom: 20px !important;
}

body.plugin_page_db_users .db-users-table {
    max-width: 1180px !important;
    overflow: hidden;
    border: 1px solid var(--sb-border) !important;
    border-radius: 14px;
    border-collapse: separate !important;
    border-spacing: 0;
    box-shadow: var(--sb-shadow);
}

body.plugin_page_db_users .db-users-table th,
body.plugin_page_db_users .db-users-table td {
    padding: 12px 14px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--sb-border) !important;
}

body.plugin_page_db_users .db-users-table th {
    color: #5d7180;
    background: #f5f8fa;
    font-size: 11px;
    letter-spacing: .05em;
    text-transform: uppercase;
}

body.plugin_page_db_users .db-users-table tr:last-child td {
    border-bottom: 0 !important;
}

/* Installed plugins use their own column model, not the links table model. */
body.plugins main[role="main"] {
    max-width: 1480px;
    padding-top: 30px !important;
}

body.plugins #plugin_summary {
    margin: 8px 0 18px;
    color: var(--sb-text-muted);
}

body.plugins table#main_table {
    table-layout: auto;
}

body.plugins table#main_table th,
body.plugins table#main_table td,
body.plugins table#main_table th:nth-child(n),
body.plugins table#main_table td:nth-child(n) {
    width: auto;
}

body.plugins table#main_table .plugin_name { width: 18%; font-weight: 700; }
body.plugins table#main_table .plugin_version { width: 8%; white-space: nowrap; }
body.plugins table#main_table .plugin_desc { width: 43%; line-height: 1.45; }
body.plugins table#main_table .plugin_author { width: 19%; }
body.plugins table#main_table .plugin_actions { width: 12%; text-align: center; }

body.plugins table#main_table .plugin_actions a {
    display: inline-block;
    padding: 7px 11px;
    color: #087b99;
    background: #eef9fa;
    border: 1px solid #bfe4e8;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
}

/* Appearance page shares the same spacing as the other admin tools. */
body.plugin_page_uikit_skin_settings #wrap > .uk-container {
    box-sizing: border-box;
    width: min(1180px, calc(100% - 48px));
    max-width: none;
    margin: 30px auto 0;
    padding: 0;
}

body.plugin_page_uikit_skin_settings .uk-card {
    max-width: 680px !important;
    border-radius: 14px !important;
}

@media (max-width: 760px) {
    .sig4-admin-page,
    body.plugin_page_db_users #wrap > h2,
    body.plugin_page_db_users #wrap > h3,
    body.plugin_page_db_users #wrap > form,
    body.plugin_page_db_users #wrap > table,
    body.plugin_page_uikit_skin_settings #wrap > .uk-container {
        width: calc(100% - 24px);
    }

    body.plugins main[role="main"] {
        overflow-x: auto;
    }
}

/* ---------- Mobile adjustments ---------- */

@media (max-width: 768px) {
    .sb-navbar { padding: 0 16px; }
    .sb-brand-logo { width: 126px; }
    #wrap > main,
    body > main { padding: 20px 16px !important; }
}

/* Section headings */
.sb-page-title,
#wrap h2,
main > h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--sb-text);
    margin: 0 0 4px;
    letter-spacing: -0.02em;
}

/* ---------- Cards ---------- */

.uk-card {
    border-radius: var(--sb-radius) !important;
    border: 1px solid var(--sb-border);
    box-shadow: var(--sb-shadow);
    background: var(--sb-card-bg) !important;
}

.uk-card-default {
    box-shadow: var(--sb-shadow);
}

.uk-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--sb-text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.uk-card-title [uk-icon] {
    color: var(--sb-accent);
}

/* ---------- Stat tiles ---------- */

.sb-stats { margin-top: 24px; }

.sb-stat-card {
    position: relative;
    overflow: hidden;
    padding: 24px !important;
    transition: transform .15s ease, box-shadow .15s ease;
}

.sb-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sb-shadow-lg);
}

.sb-stat-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    opacity: 0.18;
}

.sb-stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--sb-text);
    letter-spacing: -0.02em;
}

.sb-stat-label {
    font-size: 13px;
    color: var(--sb-text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

.sb-stat-blue  { border-left: 4px solid #1e87f0; }
.sb-stat-blue .sb-stat-icon { color: #1e87f0; }
.sb-stat-green { border-left: 4px solid #32d296; }
.sb-stat-green .sb-stat-icon { color: #32d296; }
.sb-stat-amber { border-left: 4px solid #faa05a; }
.sb-stat-amber .sb-stat-icon { color: #faa05a; }
.sb-stat-pink  { border-left: 4px solid #f0506e; }
.sb-stat-pink .sb-stat-icon { color: #f0506e; }

/* ---------- The "new link" form (top of index.php) ---------- */

#new_url { margin: 26px 0 34px; }
#new_url > div { background: #fff; border: 1px solid var(--sb-border); border-radius: 18px; box-shadow: var(--sb-shadow); padding: 24px; }
#new_url_form .sb-new-link-fields { align-items: end; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(190px, 260px) auto; }
#new_url_form .sb-new-field { color: #405969; display: grid; font-size: 12px; font-weight: 750; gap: 7px; letter-spacing: .03em; text-transform: uppercase; }

#new_url input[type="text"],
#new_url input[type="url"],
input.text,
input#add-url,
input#add-keyword,
input#add-title {
    background: #fff;
    border: 1px solid var(--sb-border);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--sb-text);
    transition: border-color .15s ease, box-shadow .15s ease;
    min-width: 0;
}

input.text:focus,
input#add-url:focus,
input#add-keyword:focus,
input#add-title:focus,
#new_url input:focus {
    outline: none;
    border-color: var(--sb-accent);
    box-shadow: 0 0 0 3px rgba(30, 135, 240, 0.12);
}

#new_url_form #add-url, #new_url_form #add-keyword { box-sizing: border-box; height: 46px; margin: 0; width: 100%; }

/* All input buttons (Shorten, etc) — give them a modern look */
input[type="button"],
input[type="submit"],
input.button,
#add-button,
button.button {
    background: var(--sb-accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: filter .15s ease, transform .05s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

input[type="button"]:hover,
input[type="submit"]:hover,
input.button:hover,
#add-button:hover,
button.button:hover {
    filter: brightness(1.05);
}

input[type="button"]:active,
input[type="submit"]:active,
input.button:active,
#add-button:active {
    transform: translateY(1px);
}

/* Secondary buttons (delete, etc) get a neutral colour */
input.button.button-warning,
input[value="Delete"] {
    background: #f0506e;
}

/* ---------- The main YOURLS table ---------- */

table#main_table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--sb-card-bg);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    overflow: hidden;
    box-shadow: var(--sb-shadow);
}

table#main_table th {
    background: #f9fafb;
    color: var(--sb-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid var(--sb-border);
    text-align: left;
}

table#main_table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--sb-border);
    vertical-align: middle;
    background: #fff;
    font-size: 14px;
    color: var(--sb-text);
}

table#main_table tr:last-child td {
    border-bottom: none;
}

table#main_table tr:hover td {
    background: #f9fafb;
}

/* The clicks column — turn it into a pill */
table#main_table td.clicks {
    font-weight: 600;
    color: var(--sb-accent);
}

/* The URL column should be readable */
table#main_table td.url {
    max-width: 380px;
    word-wrap: break-word;
}

table#main_table td.url a {
    color: var(--sb-text);
    font-weight: 500;
    text-decoration: none;
}

table#main_table td.url a:hover {
    color: var(--sb-accent);
}

/* UIkit adds a second 1200px container around the links table. Let the
   administrative workspace use the available browser width instead. */
#wrap > main > .uk-container,
body > main > .uk-container {
    box-sizing: border-box;
    max-width: none;
    padding-left: 0;
    padding-right: 0;
    width: 100%;
}

table#main_table th,
table#main_table td {
    box-sizing: border-box;
}

table#main_table th:nth-child(1), table#main_table td.keyword { width: 95px; }
table#main_table th:nth-child(2), table#main_table td.url { width: 30%; }
table#main_table th:nth-child(3), table#main_table td.timestamp { width: 92px; }
table#main_table th:nth-child(4), table#main_table td.ip { width: 130px; }
table#main_table th:nth-child(5), table#main_table td.clicks { width: 82px; }
table#main_table th:nth-child(6), table#main_table td.user, table#main_table td.username { width: 112px; }
table#main_table th:last-child,
table#main_table td.actions { display: table-cell !important; width: 278px; }

/* Do not use YOURLS' generic favicon image as a background in the URL cell.
   It is only a placeholder and looks like a missing image in the modern skin. */
table#main_table td.url a,
table#main_table td.url small a {
    background-image: none !important;
    padding-left: 0 !important;
}

table#main_table td.keyword a {
    color: var(--sb-accent);
    font-weight: 600;
    text-decoration: none;
}

/* Action buttons in rows */
table#main_table td.actions {
    white-space: nowrap;
    padding-left: 10px;
    padding-right: 6px;
}

.sb-copy-btn {
    background: transparent;
    border: 0;
    color: #0f9389;
    cursor: pointer;
    display: inline-flex;
    margin-left: 6px;
    padding: 2px 4px;
    vertical-align: middle;
}

.sb-copy-btn svg { fill: currentColor; height: 16px; width: 16px; }
.sb-copy-btn:hover, .sb-copy-btn.is-copied { color: #087f76; }

#main_table th { border-right: 1px solid #dde6eb; }
#main_table th:last-child { border-right: 0; }

/* Exclusive sig4.me action classes. No native YOURLS .button class remains. */
#main_table .sig4-actions {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
}

#main_table .sig4-action {
    align-items: center;
    background: #fff;
    border: 1px solid #cfdde3;
    border-radius: 7px;
    color: #4f5f66;
    display: inline-flex;
    font-size: 11px;
    font-weight: 700;
    height: 34px;
    justify-content: center;
    opacity: 1;
    padding: 0;
    pointer-events: auto;
    text-decoration: none;
    white-space: nowrap;
    width: 34px;
}

#main_table .sig4-action svg {
    fill: none;
    height: 18px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.65;
    pointer-events: none;
    width: 18px;
}

#main_table .sig4-action:hover {
    background: #eaf7f6;
    border-color: #70b9b3;
    color: #087f76;
    text-decoration: none;
}

#main_table .sig4-action-delete:hover {
    background: #fff1f2;
    border-color: #f3a0ad;
    color: #be123c;
}

#main_table tbody tr td { transition: background-color .15s ease; }
#main_table tbody tr:hover td { background: #f4fbfa; }
#main_table td.actions { min-width: 278px; }

@media (max-width: 1050px) {
    .sb-table-card { overflow-x: auto; }
    #main_table { min-width: 1040px; }
}

/* Wrap-card for the table */
.sb-table-card {
    margin-top: 24px;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
}

.sb-table-card #main_table {
    box-shadow: none;
    border: 1px solid var(--sb-border);
}

/* ---------- Pagination / nav_links area ---------- */

#nav_links,
.tblnavtop,
.tblnavbtm {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    flex-wrap: wrap;
    gap: 12px;
}

#nav_links a,
.navigation-links a {
    background: #fff;
    border: 1px solid var(--sb-border);
    color: var(--sb-text);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    transition: all .15s ease;
    display: inline-block;
}

#nav_links a:hover {
    border-color: var(--sb-accent);
    color: var(--sb-accent);
}

#filter_form,
.filter_form {
    background: #fff;
    border: 1px solid var(--sb-border);
    padding: 16px;
    border-radius: var(--sb-radius);
    margin: 16px 0;
}

/* ---------- Plugin list page ---------- */

table#plugins_table th,
table.tblSorter th {
    background: #f9fafb;
    color: var(--sb-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    padding: 12px 16px;
}

table#plugins_table,
table.tblSorter {
    width: 100%;
    background: var(--sb-card-bg);
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    overflow: hidden;
    box-shadow: var(--sb-shadow);
    border-collapse: separate;
    border-spacing: 0;
}

table#plugins_table td,
table.tblSorter td {
    padding: 16px;
    border-bottom: 1px solid var(--sb-border);
    background: #fff;
}

/* Plugin "Active" / "Inactive" rows */
tr.active {
    background: rgba(50, 210, 150, 0.04) !important;
}
tr.active td {
    background: transparent !important;
}

/* ---------- Notices / alerts ---------- */

.success, p.success, div.success {
    background: rgba(50, 210, 150, 0.1);
    border-left: 4px solid #32d296;
    color: #145a32;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 16px 0;
}

.error, p.error, div.error {
    background: rgba(240, 80, 110, 0.1);
    border-left: 4px solid #f0506e;
    color: #7a1a25;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 16px 0;
}

.warning, p.warning, div.warning {
    background: rgba(250, 160, 90, 0.1);
    border-left: 4px solid #faa05a;
    color: #7a3e0e;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 16px 0;
}

/* ---------- Footer ---------- */

#footer {
    text-align: center;
    padding: 24px 0;
    color: var(--sb-text-muted);
    font-size: 12px;
    border-top: 1px solid var(--sb-border);
    margin-top: 48px;
}

#footer a {
    color: var(--sb-text-muted);
    text-decoration: none;
}

#footer a:hover {
    color: var(--sb-accent);
}

/* ---------- Dashboard list cards ---------- */

.sb-list-card .uk-table {
    margin: 0;
}

.sb-list-card .uk-table th {
    background: #f9fafb;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sb-text-muted);
    font-weight: 600;
}

.sb-list-card .uk-table td a {
    color: var(--sb-accent);
    font-weight: 600;
    text-decoration: none;
}

.sb-list-title {
    color: var(--sb-text);
    font-weight: 500;
    font-size: 13px;
}

.sb-truncate {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sb-clicks-badge {
    background: var(--sb-accent);
    color: #fff;
    font-weight: 600;
    border-radius: 999px;
    padding: 4px 10px;
}

.sb-cta {
    border-radius: 999px;
    padding: 10px 24px;
    background: var(--sb-accent);
    font-weight: 600;
}

/* ---------- Login page ---------- */

body.login {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.login #wrap {
    background: #fff !important;
    border-radius: var(--sb-radius);
    padding: 40px !important;
    box-shadow: var(--sb-shadow-lg);
    max-width: 400px;
    margin: auto;
}

body.login h1 {
    display: block !important;
    text-align: center;
    margin-bottom: 24px;
}

/* ---------- Misc tweaks ---------- */

a {
    color: var(--sb-accent);
    transition: color .15s ease;
}

a:hover {
    color: var(--sb-accent);
    filter: brightness(0.9);
}

/* Prevent a:visited from overriding UIkit button colours */
a.uk-button:visited,
.uk-button:visited {
    color: inherit;
}

a.uk-button-primary:visited {
    color: #fff;
}

a.uk-button-default:visited {
    color: var(--sb-text);
}

a.uk-button-secondary:visited,
a.uk-button-danger:visited {
    color: #fff;
}

#add-button {
    margin: 0;
    border: none;
    overflow: visible;
    font: inherit;
    color: inherit;
    text-transform: none;
    -webkit-appearance: none;
    border-radius: 0;
    display: inline-block;
    box-sizing: border-box;
    align-self: end;
    height: 46px;
    padding: 0 24px;
    vertical-align: middle;
    font-size: .875rem;
    line-height: 44px;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    transition: .1s ease-in-out;
    transition-property: color, background-color, border-color;
    background-color: #1e87f0;
    color: #fff;
    border: 1px solid transparent;
}

code, pre {
    background: #f3f4f6;
    border: 1px solid var(--sb-border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
}

/* Plugin admin pages — give them card framing */
#wrap > h2 + form,
#wrap > h2 + div,
#wrap > h2 + p {
    margin-top: 16px;
}

/* The edit-row that appears inline when you edit a link */
.edit-row td {
    background: #fffbeb !important;
    border-left: 3px solid #faa05a;
}

/* Tools page checkboxes layout */
#tools_form ul,
.tools_block {
    list-style: none;
    padding: 0;
}

/* Make sure the original YOURLS share box looks decent */
#shareboxes {
    background: #fff;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius);
    padding: 16px;
    margin-top: 16px;
    box-shadow: var(--sb-shadow);
}
