:root {
  --mp-bg: #f5f6f8;
  --mp-surface: #ffffff;
  --mp-border: #e5e7eb;
  --mp-text: #111827;
  --mp-muted: #6b7280;
  --mp-primary: #4b4a8a;
  --mp-primary-hover: #3f3e75;
}

html, body {
  background: var(--mp-bg) !important;
  color: var(--mp-text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

header[role="banner"] {
  padding: 26px 0 14px;
  border: 0;
}

header[role="banner"] h1 {
  margin: 0;
}

header[role="banner"] h1 a {
  color: var(--mp-text);
  text-decoration: none;
  font-size: 20px;
  font-weight: 700;
}

header[role="banner"] h1 a span {
  font-weight: inherit;
}

header[role="banner"] img {
  max-height: 34px;
}

nav[role="navigation"] {
  display: block;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: 8px;
  padding: 4px 10px;
  margin: 0 0 24px;
}

#admin_menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#admin_menu li {
  margin: 0;
}

#admin_menu li a {
  display: inline-block;
  padding: 8px 11px;
  border-radius: 5px;
  color: var(--mp-muted);
  text-decoration: none;
  font-weight: 500;
}

#admin_menu li a:hover {
  color: var(--mp-primary);
  background: #f3f4f6;
}

#admin_menu_logout_link {
  margin-left: auto !important;
  color: var(--mp-muted);
  font-size: 13px;
}

#new_url,
#shareboxes,
#filter_form,
#main_table,
#pagination,
#login,
.plugin,
.confirm-message {
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

#new_url {
  padding: 20px;
  margin-bottom: 20px;
}

#filter_form {
  padding: 14px;
  margin-bottom: 16px;
}

#main_table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

#main_table th {
  background: #f9fafb;
  color: var(--mp-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--mp-border);
}

#main_table td,
#main_table th {
  padding: 11px 13px;
  border-bottom: 1px solid var(--mp-border);
}

#main_table tr:last-child td {
  border-bottom: 0;
}

#main_table tbody tr:hover td {
  background: #fafafa;
}

input.text,
input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
select,
textarea {
  background: var(--mp-surface) !important;
  border: 1px solid #d1d5db !important;
  border-radius: 6px !important;
  color: var(--mp-text) !important;
  padding: 8px 10px !important;
  box-shadow: none !important;
}

input.text:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(75, 74, 138, 0.16) !important;
  border-color: var(--mp-primary) !important;
}

.button,
input[type="submit"],
input[type="button"],
button {
  background: var(--mp-surface);
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: var(--mp-text);
  padding: 8px 14px;
  font-weight: 600;
  box-shadow: none;
  cursor: pointer;
}

.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
button:hover {
  border-color: #b9bac7;
}

.button.primary,
input[type="submit"].primary,
#add-button,
#login input[type="submit"] {
  background: var(--mp-primary) !important;
  border-color: var(--mp-primary) !important;
  color: #fff !important;
}

.button.primary:hover,
input[type="submit"].primary:hover,
#add-button:hover,
#login input[type="submit"]:hover {
  background: var(--mp-primary-hover) !important;
  border-color: var(--mp-primary-hover) !important;
}

a {
  color: var(--mp-primary);
}

#login {
  max-width: 500px;
  margin: 80px auto;
  padding: 28px;
}

#login p {
  margin: 0 0 16px;
}

#login label {
  color: var(--mp-text);
  font-weight: 600;
}

#footer {
  border: 0;
  color: var(--mp-muted);
  padding: 24px 0;
  text-align: center;
}

#footer a {
  color: var(--mp-muted);
  text-decoration: none;
}

p#overall_tracking {
  color: var(--mp-muted);
  margin: 0 0 20px;
}

h2 {
  color: var(--mp-text);
  font-weight: 700;
}

header[role="banner"],
#footer {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.login header[role="banner"],
body.login #footer {
  display: none !important;
}

body.login #wrap {
  max-width: 540px;
  margin: 80px auto;
}

body.login #login {
  margin: 0;
}

#wrap {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Tighter admin chrome */
header[role="banner"] {
  display: none !important;
}

nav[role="navigation"] {
  display: flex !important;
  align-items: center !important;
  gap: 6px;
  padding: 7px 14px !important;
  margin: 20px 0 22px !important;
}

nav[role="navigation"]::before {
  content: "BookSweeps Links";
  color: var(--mp-text);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  margin-right: 12px;
}

#admin_menu {
  display: flex !important;
  align-items: center !important;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

#admin_menu ul {
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

#admin_menu li {
  display: flex;
  align-items: center;
}

#admin_menu li a {
  padding: 7px 9px !important;
  font-size: 13px;
  white-space: nowrap;
}

#admin_menu_logout_link {
  order: 99;
  margin-left: auto !important;
  font-size: 12px;
  white-space: nowrap;
}

#new_url {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

#new_url > div,
#new_url form,
#new_url form > div {
  background: transparent !important;
}

#new_url form {
  background: var(--mp-surface) !important;
  border: 1px solid var(--mp-border) !important;
  border-radius: 10px !important;
  padding: 18px 20px !important;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

#new_url label {
  color: var(--mp-muted);
  font-size: 13px;
}

#footer p {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  color: var(--mp-muted) !important;
  max-width: none !important;
}

#admin_menu_logout_link {
  gap: 3px;
}

/* Mixpost-style sidebar shell */
body:not(.login) {
  background: #ffffff !important;
}

body:not(.login) #wrap {
  max-width: none !important;
  min-height: 100vh;
  margin: 0 !important;
  padding: 0 0 0 240px !important;
  background: #ffffff !important;
}

body:not(.login) header[role="banner"] {
  display: none !important;
}

body:not(.login) nav[role="navigation"] {
  position: fixed !important;
  left: 0;
  top: 0;
  bottom: 0;
  width: 240px;
  height: 100vh;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 3px !important;
  padding: 18px 14px !important;
  margin: 0 !important;
  background: #f7f4ee !important;
  border: 0 !important;
  border-right: 1px solid #e8e5df !important;
  border-radius: 0 !important;
  z-index: 100;
  overflow-y: auto;
}

body:not(.login) nav[role="navigation"]::before {
  content: "BookSweeps Links";
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 10px;
  margin: 0 0 22px;
  color: var(--mp-text);
  font-size: 15px;
  font-weight: 700;
  border-bottom: 1px solid #e8e5df;
}

body:not(.login) #admin_menu {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 3px !important;
  flex: 1;
  width: 100%;
}

body:not(.login) #admin_menu li {
  display: block !important;
  width: 100%;
}

body:not(.login) #admin_menu ul {
  display: block !important;
  margin: 0 !important;
  padding: 0 0 0 8px !important;
  list-style: none !important;
}

body:not(.login) #admin_menu li a {
  display: block;
  padding: 10px 12px !important;
  border-radius: 6px;
  color: var(--mp-muted) !important;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

body:not(.login) #admin_menu li a:hover {
  background: #ece8df !important;
  color: var(--mp-text) !important;
}

body:not(.login) #admin_menu_logout_link {
  order: 99;
  margin: auto 0 0 !important;
  padding: 14px 10px 4px !important;
  border-top: 1px solid #e8e5df;
  color: var(--mp-muted);
  font-size: 12px;
  line-height: 1.6;
}

body:not(.login) #wrap::before {
  content: "Links";
  display: block;
  height: 64px;
  line-height: 64px;
  padding: 0 32px;
  margin: 0;
  color: var(--mp-text);
  font-size: 16px;
  font-weight: 600;
  background: #fff;
  border-bottom: 1px solid var(--mp-border);
}

body:not(.login) #new_url,
body:not(.login) #shareboxes,
body:not(.login) #filter_form,
body:not(.login) #main_table,
body:not(.login) #pagination,
body:not(.login) p#overall_tracking,
body:not(.login) p {
  margin-left: 32px !important;
  margin-right: 32px !important;
}

body:not(.login) #new_url {
  margin-top: 28px !important;
}

body:not(.login) #main_table {
  width: calc(100% - 64px) !important;
}

body:not(.login) #footer {
  margin-left: 240px;
  padding: 24px 0;
  text-align: center;
}

@media (max-width: 760px) {
  body:not(.login) #wrap {
    padding-left: 0 !important;
  }
  body:not(.login) nav[role="navigation"] {
    position: relative !important;
    width: auto;
    height: auto;
    border-right: 0 !important;
    border-bottom: 1px solid #e8e5df !important;
  }
  body:not(.login) #footer {
    margin-left: 0;
  }
  body:not(.login) #new_url,
  body:not(.login) #shareboxes,
  body:not(.login) #filter_form,
  body:not(.login) #main_table,
  body:not(.login) #pagination,
  body:not(.login) p {
    margin-left: 16px !important;
    margin-right: 16px !important;
  }
  body:not(.login) #main_table {
    width: calc(100% - 32px) !important;
  }
}

/* Mixpost-esque sidebar details */
.mp-new-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 5px;
  background: var(--mp-primary);
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.08);
}

.mp-new-link:hover {
  background: var(--mp-primary-hover);
  text-decoration: none;
}

.mp-new-link span {
  font-size: 17px;
  line-height: 1;
  font-weight: 400;
}

body:not(.login) #admin_menu_admin_link > a::before,
body:not(.login) #admin_menu_db_users_link > a::before,
body:not(.login) #admin_menu_tools_link > a::before,
body:not(.login) #admin_menu_plugins_link > a::before,
body:not(.login) #admin_menu_help_link > a::before {
  display: inline-flex;
  width: 18px;
  justify-content: center;
  margin-right: 8px;
  color: #8b8b93;
  font-size: 15px;
}

body:not(.login) #admin_menu_admin_link > a::before { content: "⌂"; }
body:not(.login) #admin_menu_db_users_link > a::before { content: "◉"; }
body:not(.login) #admin_menu_tools_link > a::before { content: "⚙"; }
body:not(.login) #admin_menu_plugins_link > a::before { content: "◈"; }
body:not(.login) #admin_menu_help_link > a::before { content: "?"; }

body:not(.login) #new_url form::before {
  content: "Create a short link";
  display: block;
  margin-bottom: 14px;
  color: var(--mp-text);
  font-size: 14px;
  font-weight: 600;
}

/* Match Mixpost actual design tokens */
:root {
  --mp-bg: #ffffff;
  --mp-surface: #ffffff;
  --mp-border: #e7e4df;
  --mp-text: #1d1d1f;
  --mp-muted: #6f6f73;
  --mp-primary: #3f3896;
  --mp-primary-hover: #26225a;
  --mp-sidebar: #f7f4f0;
}

@font-face {
  font-family: "Mixpost Inter";
  src: url("https://post.booksweeps.com/vendor/mixpost/assets/Inter-Regular-COLGFB3M.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mixpost Inter";
  src: url("https://post.booksweeps.com/vendor/mixpost/assets/Inter-Medium-CDhBSFyE.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

body,
input,
button,
select,
textarea {
  font-family: "Mixpost Inter", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

body:not(.login) nav[role="navigation"] {
  background: var(--mp-sidebar) !important;
}

body:not(.login) #wrap::before {
  content: "Home" !important;
}

body:not(.login) #new_url form,
body:not(.login) #filter_form,
body:not(.login) #main_table,
body:not(.login) #shareboxes,
body:not(.login) #pagination,
body:not(.login) #login,
.mp-new-link,
.button,
input[type="submit"],
input[type="button"],
button,
input.text,
input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
select,
textarea {
  border-radius: 0 !important;
}

body:not(.login) #new_url form,
body:not(.login) #filter_form,
body:not(.login) #main_table {
  border-color: var(--mp-border) !important;
}

.mp-new-link,
.button.primary,
input[type="submit"].primary,
#add-button,
#login input[type="submit"] {
  background: var(--mp-primary) !important;
  border-color: var(--mp-primary) !important;
}

/* Actual Mixpost-like brand/user details */
body:not(.login) nav[role="navigation"]::before {
  display: none !important;
  content: none !important;
}

body:not(.login) #wrap {
  position: relative;
}

body:not(.login) #admin_menu_admin_link > a {
  background: #ece8df !important;
  color: var(--mp-text) !important;
}

.mp-workspace {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 10px;
  margin: 0 0 18px;
  border-bottom: 1px solid #e8e5df;
  color: var(--mp-text);
  font-size: 14px;
  font-weight: 600;
}

.mp-logo-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3f3896 50%, #84e9f5 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.mp-workspace-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-workspace-chevron {
  color: #9a9aa0;
  font-size: 14px;
}

.mp-user-avatar {
  position: absolute;
  top: 13px;
  right: 32px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #d9f7f1;
  color: #3f3896;
  font-size: 12px;
  font-weight: 600;
  z-index: 20;
}

/* Sidebar must not overlap page headings */
body:not(.login) nav[role="navigation"],
body:not(.login) #wrap {
  box-sizing: border-box !important;
}

body.plugins #wrap::before { content: "Plugins" !important; }
body.tools #wrap::before { content: "Tools" !important; }

/* Final Mixpost parity */
body:not(.login) a {
  color: var(--mp-primary) !important;
}

body:not(.login) #wrap > h1 {
  display: none !important;
}

body.plugins #admin_menu_admin_link > a,
body.tools #admin_menu_admin_link > a {
  background: transparent !important;
  color: var(--mp-muted) !important;
}

body.plugins #admin_menu_plugins_link > a {
  background: #ece8df !important;
  color: var(--mp-text) !important;
}

body.tools #admin_menu_tools_link > a {
  background: #ece8df !important;
  color: var(--mp-text) !important;
}

/* Final nav parity */
body:not(.login) #admin_menu li a {
  display: flex !important;
  align-items: center;
}

body:not(.login) #admin_menu_admin_link > a::before,
body:not(.login) #admin_menu_db_users_link > a::before,
body:not(.login) #admin_menu_tools_link > a::before,
body:not(.login) #admin_menu_plugins_link > a::before,
body:not(.login) #admin_menu_help_link > a::before {
  content: none !important;
  display: none !important;
}

.mp-nav-icon {
  width: 16px;
  height: 16px;
  margin-right: 9px;
  flex-shrink: 0;
  fill: none;
  stroke: #8b8b93;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mp-nav-label {
  padding: 18px 12px 7px;
  color: #9b9b9f;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

body:not(.login) #admin_menu_logout_link {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 10px 4px !important;
  font-size: 12px;
}

body:not(.login) #admin_menu_logout_link .mp-user-name {
  color: var(--mp-muted);
}

body:not(.login) #admin_menu_logout_link a {
  display: inline-flex !important;
  padding: 0 !important;
  color: var(--mp-primary) !important;
  font-size: 12px;
}

body:not(.login) .mp-new-link,
body:not(.login) .mp-new-link span {
  color: #ffffff !important;
}

body:not(.login) #admin_menu_logout_link {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 7px !important;
  white-space: nowrap;
}

body:not(.login) #admin_menu_logout_link .mp-user-name,
body:not(.login) #admin_menu_logout_link a {
  display: inline !important;
  width: auto !important;
  flex: 0 0 auto !important;
}

body:not(.login) #admin_menu_logout_link a::before {
  content: "·";
  color: #9b9b9f;
  margin-right: 7px;
}

/* Profile menu in the top-right */
.mp-profile {
  position: absolute;
  top: 13px;
  right: 32px;
  z-index: 40;
}

.mp-profile summary.mp-user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #d9f7f1;
  color: #3f3896;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.mp-profile summary::-webkit-details-marker {
  display: none;
}

.mp-profile-menu {
  position: absolute;
  top: 46px;
  right: 0;
  min-width: 150px;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--mp-border);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
}

.mp-profile-menu a {
  display: block !important;
  padding: 9px 10px !important;
  color: var(--mp-text) !important;
  font-size: 13px;
  text-decoration: none;
}

.mp-profile-menu a:hover {
  background: #f3f4f6;
}

.mp-profile summary.mp-user-avatar {
  position: static !important;
  top: auto !important;
  right: auto !important;
}

/* Top-right profile trigger */
.mp-profile summary.mp-profile-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 4px;
  border-radius: 5px;
  list-style: none;
  cursor: pointer;
  color: #9a9aa0;
}

.mp-profile summary.mp-profile-trigger:hover {
  background: #f3f1ed;
}

.mp-profile summary.mp-profile-trigger::-webkit-details-marker {
  display: none;
}

.mp-profile-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.mp-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #cdf3e8;
  color: #256a55;
  font-size: 12px;
  font-weight: 600;
}

/* Header row parity with Mixpost */
body:not(.login) nav[role="navigation"] {
  padding: 0 14px !important;
  gap: 0 !important;
}

.mp-workspace {
  height: 64px;
  min-height: 64px;
  margin: 0 -14px 16px;
  padding: 0 16px;
  gap: 10px;
  border-bottom: 1px solid #e8e5df;
  font-size: 12px;
  font-weight: 600;
}

.mp-logo-mark {
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}

.mp-workspace-slash {
  color: #a7a39b;
  font-size: 14px;
  font-weight: 400;
  margin: 0 1px;
}

.mp-workspace-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
}

.mp-workspace-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: #8f8b84;
  font-size: 0;
}

.mp-workspace-chevron svg {
  width: 16px;
  height: 16px;
}

body:not(.login) #wrap::before {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 64px;
  line-height: 64px;
  background: #f7f4f0;
  border-bottom: 1px solid #e8e5df;
  font-size: 16px;
  font-weight: 500;
}

.mp-profile {
  top: 10px;
  right: 24px;
}

.mp-profile-menu {
  top: 48px;
}

/* True Mixpost app shell: fixed aside + main column with topbar and scroll region */
body:not(.login) {
  overflow: hidden !important;
}

.mp-shell {
  display: flex;
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: #fff;
}

.mp-aside {
  width: 240px;
  flex: 0 0 240px;
  height: 100vh;
  background: #f7f4f0;
  border-right: 1px solid #e8e5df;
}

body:not(.login) .mp-aside nav[role="navigation"] {
  position: static !important;
  inset: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0 !important;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  background: #f7f4f0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: hidden !important;
}

.mp-aside .mp-workspace {
  flex: 0 0 64px;
  height: 64px;
  min-height: 64px;
  margin: 0;
  padding: 0 16px;
  border-bottom: 1px solid #e8e5df;
}

.mp-aside .mp-new-link {
  flex: 0 0 auto;
  margin: 12px 14px 16px;
  min-height: 36px;
  padding: 7px 12px;
}

.mp-aside-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 14px 16px;
}

.mp-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.mp-topbar {
  flex: 0 0 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
  background: #f7f4f0;
  border-bottom: 1px solid #e8e5df;
}

.mp-page-title {
  margin: 0;
  color: #1d1d1f;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
}

.mp-page-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #fff;
}

body:not(.login) .mp-page-scroll #wrap {
  max-width: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  background: #fff !important;
}

body:not(.login) .mp-page-scroll #wrap::before {
  display: none !important;
  content: none !important;
}

body:not(.login) .mp-page-scroll #footer {
  margin-left: 0 !important;
}

body:not(.login) .mp-profile {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  flex: 0 0 auto;
}

body:not(.login) .mp-profile-menu {
  top: 48px;
  right: 0;
}

@media (max-width: 900px) {
  body:not(.login) {
    overflow: auto !important;
  }

  .mp-shell {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .mp-aside {
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid #e8e5df;
  }

  body:not(.login) .mp-aside nav[role="navigation"] {
    height: auto !important;
    overflow: visible !important;
  }

  .mp-aside-scroll {
    overflow: visible;
  }

  .mp-main {
    height: auto;
    overflow: visible;
  }

  .mp-page-scroll {
    overflow: visible;
  }
}

html.mp-app-ready,
html.mp-app-ready body {
  height: 100%;
  overflow: hidden !important;
}

@media (max-width: 900px) {
  html.mp-app-ready,
  html.mp-app-ready body {
    height: auto;
    overflow: auto !important;
  }
}

html.mp-app-ready body {
  margin: 0 !important;
  padding: 0 !important;
}

html.mp-app-ready .mp-shell {
  margin: 0 !important;
  padding: 0 !important;
}

/* Sidebar parity: Mixpost's compact 240px navigation */
.mp-aside {
  box-sizing: border-box;
  width: 240px;
  flex: 0 0 240px;
}

.mp-aside .mp-workspace {
  flex-basis: 52px;
  height: 52px;
  min-height: 52px;
  padding: 0 24px;
  gap: 8px;
}

.mp-workspace-slash {
  font-size: 16px;
  line-height: 1;
}

.mp-aside .mp-new-link {
  margin: 8px 18px;
  min-height: 36px;
  padding: 6px 16px;
  gap: 8px;
  border-radius: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
}

.mp-new-link span {
  font-size: 20px;
  font-weight: 400;
}

.mp-aside-scroll {
  padding: 0 24px 16px;
}

body:not(.login) .mp-aside #admin_menu {
  gap: 0 !important;
}

body:not(.login) .mp-aside #admin_menu li a {
  margin: 0 -8px;
  padding: 8px !important;
  border-radius: 0;
  gap: 12px;
  color: #1d1d1f !important;
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
}

body:not(.login) .mp-aside #admin_menu li a:hover {
  background: rgba(0, 0, 0, .025) !important;
}

.mp-nav-icon {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  stroke: #6f6f73;
  stroke-width: 1.5;
}

.mp-nav-label {
  margin: 24px 0 12px;
  padding: 0;
  color: #6f6f73;
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  letter-spacing: 0;
  text-transform: none;
}

.mp-topbar,
.mp-aside .mp-workspace {
  flex-basis: 52px;
  height: 52px;
}

.mp-topbar {
  padding: 0 24px;
}

.mp-page-title {
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
}

body:not(.login) .mp-profile summary.mp-profile-trigger {
  gap: 8px;
  padding: 8px;
  border-radius: 0;
}

.mp-profile-menu {
  top: 52px;
}

body:not(.login) #admin_menu_admin_link > a {
  background: rgba(0, 0, 0, .05) !important;
}

body.plugins #admin_menu_admin_link > a,
body.tools #admin_menu_admin_link > a {
  background: transparent !important;
}

/* Align page content with the topbar's 24px gutter */
body:not(.login) #new_url,
body:not(.login) #shareboxes,
body:not(.login) #filter_form,
body:not(.login) #main_table,
body:not(.login) #pagination,
body:not(.login) p#overall_tracking,
body:not(.login) p {
  margin-left: 24px !important;
  margin-right: 24px !important;
}

body:not(.login) #new_url {
  margin-top: 24px !important;
}

body:not(.login) #main_table {
  width: calc(100% - 48px) !important;
}

.mp-shell,
.mp-shell * {
  box-sizing: border-box;
}

body:not(.login) .mp-aside #admin_menu .mp-nav-icon {
  margin-right: 0;
}

.mp-aside .mp-new-link {
  height: 36px;
  min-height: 36px;
  max-height: 36px;
}

.mp-nav-label {
  text-align: left;
}

.mp-aside-scroll {
  padding-bottom: 0;
}

.mp-aside .mp-new-link {
  margin: 16px 18px;
}

/* Mixpost New post icon alignment */
.mp-aside .mp-new-link {
  gap: 0;
}

.mp-new-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin-right: 8px;
  font-size: 0;
  line-height: 0;
}

.mp-new-link-icon svg {
  display: block;
  width: 20px;
  height: 20px;
}

.mp-aside .mp-new-link > span:last-child {
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
}

.mp-aside .mp-new-link .mp-new-link-icon {
  font-size: 0;
  line-height: 0;
}

/* Brand row: mirror Mixpost structure, YOURLS mark */
.mp-logo-mark {
  display: block;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  object-fit: contain;
}

.mp-workspace-slash {
  display: block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 0;
  color: #6f6f73;
  font-size: 0;
}

.mp-workspace-button {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  margin: 0 -8px;
  padding: 8px;
  border-radius: 0;
}

.mp-workspace-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Content gutter on non-Links admin pages */
body:not(.login) .mp-page-scroll #wrap.mp-config-wrap {
  padding: 24px !important;
}

/* Config pages: topbar carries the title */
body:not(.login) .mp-config-wrap > h2 {
  display: none;
}

body:not(.login) .mp-config-wrap > h3:first-of-type {
  margin-top: 0;
}

/* YOURLS login, matched to the Mixpost login screen */
body.login {
  min-height: 100vh;
  margin: 0 !important;
  padding: 28px 16px 40px !important;
  background: #f7f4f0 !important;
  color: #1d1d1f;
}

body.login #wrap {
  width: 100%;
  max-width: 512px;
  min-height: 0;
  margin: 0 auto !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.login header[role="banner"] {
  display: block !important;
  padding: 0 0 44px !important;
  border: 0 !important;
  text-align: center;
}

body.login header[role="banner"] h1 {
  margin: 0 !important;
  padding: 0 !important;
}

.mp-login-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #1d1d1f !important;
  text-decoration: none !important;
}

.mp-login-logo {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.mp-login-brand span {
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
}

body.login #login {
  width: 100%;
  margin: 0 !important;
  padding: 24px !important;
  background: #fff !important;
  border: 1px solid #e3dfd8 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  box-sizing: border-box;
}

.mp-login-heading {
  margin: 0 0 4px !important;
  padding: 0 !important;
  color: #1d1d1f;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
}

.mp-login-subheading {
  margin: 0 0 22px !important;
  padding: 0 !important;
  color: #6f6f73;
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
}

body.login #login form {
  margin: 0 !important;
  padding: 0 !important;
}

body.login #login form > p {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 224px;
  align-items: center;
  gap: 16px;
  margin: 0 0 16px !important;
  padding: 0 !important;
}

body.login #login form > p:has(#error-message) {
  display: block;
  margin-bottom: 14px !important;
}

body.login #login form > p:last-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 0 !important;
}

body.login #login form label {
  display: block;
  margin: 0 !important;
  color: #1d1d1f;
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
}

body.login #login form label br {
  display: none;
}

body.login #login form input.text {
  width: 100% !important;
  height: 32px !important;
  margin: 0 !important;
  padding: 5px 10px !important;
  background: #fff !important;
  border: 1px solid #d5d1ca !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: #1d1d1f !important;
  font-size: 14px !important;
  line-height: 20px !important;
  box-sizing: border-box;
}

body.login #login form input.text:focus {
  outline: none !important;
  border-color: #3f3896 !important;
  box-shadow: 0 0 0 2px rgba(63, 56, 150, 0.15) !important;
}

body.login #login form input#submit,
body.login #login form .button {
  width: auto !important;
  min-width: 76px;
  height: 32px !important;
  margin: 0 !important;
  padding: 0 12px !important;
  background: #3f3896 !important;
  border: 1px solid #3f3896 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: #fff !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 30px !important;
  cursor: pointer;
}

body.login #login form input#submit:hover {
  background: #26225a !important;
  border-color: #26225a !important;
}

.mp-login-help {
  color: #3f3896 !important;
  font-size: 14px;
  text-decoration: none !important;
  white-space: nowrap;
}

.mp-login-help:hover {
  text-decoration: underline !important;
}

body.login #login .error {
  margin: 0 !important;
  padding: 8px 10px !important;
  border-radius: 0 !important;
  background: #fff1f0 !important;
  color: #b42318 !important;
  font-size: 13px !important;
  line-height: 18px;
}

body.login #footer {
  display: none !important;
}

@media (max-width: 560px) {
  body.login {
    padding-top: 20px !important;
  }

  body.login header[role="banner"] {
    padding-bottom: 28px !important;
  }

  body.login #login form > p {
    display: block;
  }

  body.login #login form label {
    margin-bottom: 6px !important;
  }

  body.login #login form > p:last-child {
    display: flex;
  }
}

/* Login form metrics to match Mixpost */
.mp-login-heading {
  font-weight: 500 !important;
}

.mp-login-subheading {
  margin-bottom: 22px !important;
}

body.login #login form > p {
  margin-bottom: 18px !important;
}

body.login #login form label {
  font-weight: 500;
}

body.login #login form input.text {
  height: 36px !important;
  padding: 6px 12px !important;
  line-height: 22px !important;
}

body.login #login form input#submit,
body.login #login form .button {
  min-width: 76px;
  height: 36px !important;
  padding: 0 16px !important;
  line-height: 34px !important;
}

body.login #login form > p.mp-login-remember {
  display: block;
  margin: 18px 0 0 !important;
}

.mp-login-remember label {
  display: flex !important;
  align-items: center;
  gap: 6px;
  color: #1d1d1f;
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
}

.mp-login-remember input[type="checkbox"] {
  width: 20px !important;
  height: 20px !important;
  margin: 0 !important;
  border: 1px solid #6f6f73 !important;
  border-radius: 0 !important;
  accent-color: #3f3896;
  cursor: pointer;
}

body.login #login form > p:last-child {
  margin-top: 24px !important;
}

.mp-login-forgot {
  color: #3f3896 !important;
  font-size: 14px;
  line-height: 22px;
  text-decoration: none !important;
  white-space: nowrap;
}

.mp-login-forgot:hover {
  text-decoration: underline !important;
}

body.login #login form > p > br {
  display: none !important;
}

body.login #login {
  max-width: 512px !important;
}

body.login header[role="banner"] {
  padding-bottom: 55px !important;
}

body.login .mp-login-subheading {
  font-weight: 400 !important;
}

body.login #login form > p {
  grid-template-columns: 224px 224px;
  gap: 12px;
}

/* README inside the admin shell */
.mp-readme-frame iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 100px);
  border: 0;
  background: #fff;
}

/* Link filters */
body:not(.login) #main_table tfoot {
  display: none !important;
}

body:not(.login) #filter_form {
  margin: 0 24px 20px !important;
  padding: 16px !important;
  background: #fff !important;
  border: 1px solid #e7e4df !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.mp-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
  align-items: center;
}

.mp-filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.mp-filter-label {
  min-width: 72px;
  color: #6f6f73;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.mp-filter-hint {
  color: #6f6f73;
  font-size: 12px;
}

#filter_form input.text,
#filter_form select {
  height: 32px !important;
  margin: 0 !important;
  padding: 4px 8px !important;
  background: #fff !important;
  border: 1px solid #d5d1ca !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: #1d1d1f;
  font-size: 13px;
}

#filter_form input[name="search"] {
  flex: 1;
  min-width: 130px;
}

#filter_form input[name="perpage"] {
  width: 56px;
}

#filter_form input[name="click_limit"] {
  width: 72px;
}

#filter_form input[name="date_first"],
#filter_form input[name="date_second"] {
  width: 130px;
}

.mp-filter-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.mp-filter-actions .button {
  min-width: 76px;
  height: 32px !important;
  margin: 0 !important;
}

body:not(.login) #main_table {
  table-layout: fixed;
  width: calc(100% - 48px) !important;
  min-width: 0 !important;
  overflow: hidden;
}

body:not(.login) #main_table th:nth-child(1),
body:not(.login) #main_table td:nth-child(1) { width: 17%; }
body:not(.login) #main_table th:nth-child(2),
body:not(.login) #main_table td:nth-child(2) { width: 34%; }
body:not(.login) #main_table th:nth-child(3),
body:not(.login) #main_table td:nth-child(3) { width: 13%; }
body:not(.login) #main_table th:nth-child(4),
body:not(.login) #main_table td:nth-child(4) { width: 12%; }
body:not(.login) #main_table th:nth-child(5),
body:not(.login) #main_table td:nth-child(5) { width: 8%; }
body:not(.login) #main_table th:nth-child(6),
body:not(.login) #main_table td:nth-child(6) { width: 16%; }

body:not(.login) #main_table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 760px) {
  .mp-filter-grid {
    grid-template-columns: 1fr;
  }
}

/* Native README documentation panel */
.mp-doc {
  margin: 24px;
  padding: 24px;
  max-width: 1000px;
  background: #fff;
  border: 1px solid #e7e4df;
}

.mp-doc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: 24px;
  border-bottom: 1px solid #e7e4df;
}

.mp-doc-tab {
  margin: 0 0 -1px;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: #6f6f73;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.mp-doc-tab:hover {
  color: #1d1d1f;
  background: #f7f4f0;
}

.mp-doc-tab.is-active {
  color: #3f3896;
  border-bottom-color: #3f3896;
}

.mp-doc-panel {
  display: none;
  max-width: 820px;
  color: #1d1d1f;
  font-size: 14px;
  line-height: 1.65;
}

.mp-doc-panel.is-active {
  display: block;
}

.mp-doc-panel h2,
.mp-doc-panel h3,
.mp-doc-panel h4 {
  margin: 1.4em 0 0.55em;
  color: #1d1d1f;
  line-height: 1.25;
}

.mp-doc-panel h2.first,
.mp-doc-panel h2:first-of-type {
  margin-top: 0;
}

.mp-doc-panel h2 { font-size: 22px; font-weight: 600; }
.mp-doc-panel h3 { font-size: 17px; font-weight: 600; }
.mp-doc-panel h4 { font-size: 15px; font-weight: 600; }

.mp-doc-panel p,
.mp-doc-panel ul,
.mp-doc-panel ol {
  margin: 0 0 14px;
}

.mp-doc-panel ul,
.mp-doc-panel ol {
  padding-left: 22px;
}

.mp-doc-panel li {
  margin: 5px 0;
}

.mp-doc-panel a {
  color: #3f3896;
  text-decoration: none;
}

.mp-doc-panel a:hover {
  text-decoration: underline;
}

.mp-doc-panel code,
.mp-doc-panel tt {
  padding: 1px 4px;
  background: #f3f1ed;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.mp-doc-panel pre {
  overflow-x: auto;
  padding: 12px;
  background: #f7f4f0;
  border: 1px solid #e7e4df;
  font-size: 12px;
  line-height: 1.5;
}

.mp-doc-panel blockquote {
  margin: 14px 0;
  padding: 10px 14px;
  background: #f7f4f0;
  border-left: 3px solid #d5d1ca;
}

.mp-doc-panel img {
  max-width: 100%;
  height: auto;
  border: 1px solid #e7e4df;
}

.mp-doc-panel .anch {
  display: block;
  color: inherit;
  text-decoration: none;
}

.mp-doc-panel .anch > span {
  color: #3f3896;
}

/* Share boxes: let content determine height */
body:not(.login) #shareboxes {
  overflow: visible !important;
  padding: 16px !important;
  display: flow-root;
}

body:not(.login) #shareboxes::after {
  content: "";
  display: table;
  clear: both;
}

body:not(.login) #shareboxes .share {
  height: auto !important;
  min-height: 0 !important;
  padding: 14px 16px !important;
  border: 1px solid #e7e4df !important;
  border-radius: 0 !important;
  background: #fff !important;
}

body:not(.login) #shareboxes #copybox {
  width: 250px !important;
}

body:not(.login) #shareboxes #sharebox {
  width: min(500px, calc(100% - 274px)) !important;
}

body:not(.login) #origlink {
  width: auto !important;
  max-width: 180px;
  white-space: normal !important;
  overflow-wrap: anywhere;
  overflow: visible !important;
}

body:not(.login) #tweet_body {
  width: 100% !important;
  height: 64px !important;
  float: none !important;
  box-sizing: border-box;
}

/* One-row full-width filter bar */
body:not(.login) #filter_form {
  float: none !important;
  max-width: none !important;
  width: calc(100% - 48px) !important;
}

.mp-filter-grid {
  grid-template-columns: minmax(220px, 2.2fr) minmax(160px, 1.4fr) 90px minmax(130px, 1.2fr) minmax(250px, 2.2fr) auto !important;
  gap: 12px !important;
  align-items: end !important;
}

.mp-filter-group {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  flex-wrap: nowrap !important;
  gap: 4px !important;
}

.mp-filter-label {
  min-width: 0 !important;
  font-size: 11px !important;
  line-height: 16px !important;
}

.mp-filter-controls {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
}

#filter_form input.text,
#filter_form select {
  height: 30px !important;
  padding: 3px 7px !important;
  min-width: 0;
}

#filter_form input[name="search"] {
  flex: 1;
  min-width: 100px;
}

#filter_form input[name="perpage"],
#filter_form select[name="perpage"] {
  width: 62px;
}

#filter_form input[name="click_limit"] {
  width: 62px;
}

#filter_form input[name="date_first"],
#filter_form input[name="date_second"] {
  width: 92px;
}

.mp-filter-actions {
  grid-column: auto !important;
  margin: 0 !important;
  display: flex;
  align-items: end;
  gap: 6px;
}

.mp-filter-actions .button {
  min-width: 62px;
  height: 30px !important;
  padding: 0 10px !important;
  font-size: 13px !important;
}

.mp-doc-panel .anch > span {
  display: none;
}

@media (max-width: 1180px) {
  .mp-filter-grid {
    display: flex !important;
    flex-wrap: wrap;
  }

  .mp-filter-group {
    flex: 1 1 180px;
  }
}

/* Fit every filter control and both date fields on one row */
.mp-filter-grid {
  grid-template-columns: 230px 200px 72px 165px 280px 134px !important;
  gap: 6px !important;
}

#filter_form select[name="search_in"] { width: 83px; }
#filter_form select[name="sort_by"] { width: 94px; }
#filter_form select[name="sort_order"] { width: 100px; }
#filter_form select[name="click_filter"] { width: 76px; }
#filter_form select[name="date_filter"] { width: 80px; }
#filter_form input[name="search"] { min-width: 85px; }

@media (max-width: 1180px) {
  .mp-filter-grid {
    grid-template-columns: none !important;
  }
}

.mp-filter-grid {
  grid-template-columns: 222px 208px 72px 165px 280px 134px !important;
}

#filter_form select[name="sort_order"] { width: 108px; }
#filter_form select[name="date_filter"] { width: 76px; }
#filter_form input[name="date_first"],
#filter_form input[name="date_second"] { width: 88px; }

/* Delete confirmation dialog, matched to the admin shell */
#delete-confirm-dialog {
  width: min(512px, calc(100vw - 32px));
  height: auto;
  max-height: calc(100vh - 40px);
  margin: auto;
  padding: 0 !important;
  overflow: auto;
  background: #fff;
  border: 1px solid #e7e4df;
  border-radius: 0;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .18);
  color: #1d1d1f;
}

#delete-confirm-dialog > div[name="dialog_title"] {
  padding: 16px 24px;
  background: #f7f4f0;
  border-bottom: 1px solid #e7e4df;
  color: #1d1d1f;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  border-radius: 0;
}

#delete-confirm-dialog div.confirm-message {
  width: auto;
  height: auto;
  padding: 20px 24px;
  overflow: visible;
  background: #fff;
}

#delete-confirm-dialog div.confirm-message > p {
  margin: 0 0 12px;
  font-size: 14px;
}

#delete-confirm-dialog div.confirm-message ul {
  margin: 0;
  padding: 12px 14px;
  background: #f7f4f0;
  border-left: 3px solid #d5d1ca;
  list-style: none;
}

#delete-confirm-dialog div.confirm-message ul li {
  margin: 6px 0;
  font-size: 13px;
  line-height: 1.5;
}

#delete-confirm-dialog div.confirm-message ul li span {
  display: inline-block;
  max-width: 100%;
  padding: 2px 6px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #1d1d1f;
  overflow-wrap: anywhere;
}

#delete-confirm-dialog div.button-group {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  width: auto;
  height: auto;
  padding: 16px 24px;
  background: #fff;
  border-top: 1px solid #e7e4df;
  text-align: right;
  border-radius: 0;
}

#delete-confirm-dialog div.button-group .button {
  min-width: 76px;
  height: 32px !important;
  margin: 0 !important;
  padding: 0 12px !important;
  font-size: 13px !important;
}

#delete-confirm-dialog::backdrop {
  background: rgba(0, 0, 0, .35);
  opacity: 1;
}

/* Polished, equal-height share boxes */
body:not(.login) #shareboxes[style*="display: block"],
body:not(.login) #shareboxes[style*="display:block"] {
  display: grid !important;
  grid-template-columns: minmax(280px, 32%) minmax(0, 1fr);
  align-items: stretch !important;
  gap: 16px !important;
}

body:not(.login) #shareboxes .share {
  display: flex;
  flex-direction: column;
  float: none !important;
  width: auto !important;
  height: 100% !important;
  margin: 0 !important;
}

body:not(.login) #shareboxes .share h2 {
  margin: 0 0 16px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 1.3;
}

body:not(.login) #copybox,
body:not(.login) #sharebox {
  width: auto !important;
}

body:not(.login) #copylink {
  width: 100% !important;
  height: 36px !important;
  padding: 6px 32px 6px 10px !important;
  border: 1px solid #d5d1ca !important;
  background-color: #fff !important;
  font-size: 13px !important;
}

body:not(.login) #shareboxes small {
  font-size: 12px;
  line-height: 1.6;
}

body:not(.login) #shareboxes p {
  margin: 0 0 8px;
}

body:not(.login) #tweet {
  display: flex;
  flex-direction: column;
}

body:not(.login) #charcount {
  order: -1;
  padding: 0 0 4px !important;
  color: #6f6f73 !important;
  font-size: 12px;
  text-align: right;
}

body:not(.login) #tweet_body {
  flex: 1;
  min-height: 72px;
}

body:not(.login) #share_links {
  margin: auto 0 0 !important;
  padding-top: 12px;
  border-top: 1px solid #f0ede8;
  font-size: 13px;
}

/* Keep the dialog content-sized and centered */
#delete-confirm-dialog {
  position: fixed;
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: fit-content;
  max-height: calc(100vh - 40px);
}

/* Share boxes: visible state is an empty inline style after toggle */
body:not(.login) #shareboxes:not([style*="display: none"]):not([style*="display:none"]) {
  display: grid !important;
  grid-template-columns: minmax(280px, 32%) minmax(0, 1fr);
  align-items: stretch !important;
  gap: 16px !important;
}

body:not(.login) #shareboxes #copybox,
body:not(.login) #shareboxes #sharebox {
  width: 100% !important;
}

body:not(.login) #origlink {
  max-width: none !important;
  width: auto !important;
  overflow: visible !important;
  word-break: break-word;
}

body:not(.login) #charcount {
  order: 2;
  padding: 4px 0 0 !important;
  text-align: right;
}

body:not(.login) #charcount {
  order: 0;
  margin-top: 6px;
  padding: 0 !important;
  text-align: right;
  font-size: 12px;
}

/* Flatten the delete dialog: one surface, no box-in-box */
#delete-confirm-dialog .confirm-message {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

#delete-confirm-dialog .confirm-message ul {
  margin: 0 !important;
  padding: 0 0 0 14px !important;
  background: transparent !important;
  border-left: 2px solid #d5d1ca !important;
}

#delete-confirm-dialog .confirm-message ul li span {
  background: transparent !important;
  padding: 0 !important;
}

/* Flexible one-row filter; actions stay at the far right */
.mp-filter-grid {
  grid-template-columns: minmax(220px, 2.2fr) minmax(180px, 1.5fr) minmax(70px, .65fr) minmax(155px, 1.1fr) minmax(290px, 2.1fr) auto !important;
  gap: 8px !important;
}

#filter_form select[name="search_in"] { width: 100px !important; }
#filter_form select[name="sort_by"],
#filter_form select[name="sort_order"] {
  flex: 1;
  width: auto !important;
  min-width: 90px;
}
#filter_form select[name="click_filter"] { width: 80px !important; }
#filter_form select[name="date_filter"] { width: 80px !important; }
#filter_form input[name="date_first"],
#filter_form input[name="date_second"] {
  flex: 1;
  width: auto !important;
  min-width: 92px;
}

/* Keep the date picker above the page content */
table.datepicker {
  z-index: 2000 !important;
  border: 1px solid #cfcac2 !important;
  background: #fff !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
}

@media (max-width: 1180px) {
  .mp-filter-grid {
    grid-template-columns: none !important;
  }
}

body:not(.login) #shareboxes .share {
  min-width: 0 !important;
  max-width: 100% !important;
}

body:not(.login) #sharebox {
  position: relative;
  padding-bottom: 34px !important;
}

body:not(.login) #charcount {
  position: absolute !important;
  right: 14px;
  bottom: 10px;
  display: block;
  margin: 0 !important;
  padding: 0 !important;
  text-align: right;
  font-size: 12px;
  line-height: 18px;
}

.mp-filter-grid {
  grid-template-columns: minmax(211px, 2.2fr) minmax(210px, 1.6fr) minmax(70px, .65fr) minmax(155px, 1.1fr) minmax(290px, 2.1fr) auto !important;
}

#filter_form select[name="sort_by"] {
  flex: 1;
  min-width: 88px;
}

#filter_form select[name="sort_order"] {
  flex: 0 0 110px;
  width: 110px !important;
  min-width: 110px;
}

.mp-filter-grid {
  grid-template-columns: minmax(211px, 2.2fr) minmax(210px, 1.6fr) auto minmax(155px, 1.1fr) minmax(290px, 2.1fr) auto !important;
  gap: 6px !important;
}

/* Link count + tracking summary under the table */
.mp-log-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 10px 24px 18px;
  color: #6f6f73;
  font-size: 13px;
  line-height: 20px;
}

.mp-log-summary .mp-summary-item {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  color: #6f6f73 !important;
  font-size: 13px !important;
  line-height: 20px !important;
}

.mp-log-summary .mp-summary-item strong {
  color: #1d1d1f;
  font-weight: 600;
}

.mp-summary-sep {
  color: #b8b3ab;
  font-size: 14px;
  line-height: 1;
}

.mp-log-summary,
.mp-log-summary .mp-summary-item {
  font-size: 12px !important;
  line-height: 18px !important;
}

.mp-log-summary .mp-summary-powered {
  margin: 0 0 0 auto !important;
  padding: 0 !important;
  max-width: none !important;
  background: transparent !important;
  border: 0 !important;
  color: #6f6f73 !important;
  font-size: 12px !important;
  line-height: 18px !important;
  text-align: right !important;
  white-space: nowrap;
}

.mp-log-summary .mp-summary-powered a {
  color: #6f6f73 !important;
  text-decoration: none !important;
}

.mp-log-summary .mp-summary-powered a:hover {
  text-decoration: underline !important;
}

.mp-log-summary .mp-summary-sep {
  display: inline-block;
  width: 1px;
  height: 14px;
  margin: 0 3px;
  background: #d5d1ca;
  color: transparent;
  font-size: 0;
  line-height: 0;
}

.mp-log-summary #overall_tracking {
  margin-left: auto !important;
}

.mp-log-summary .mp-summary-powered {
  margin-left: 11px !important;
}

body:not(.login) .mp-log-summary #overall_tracking {
  margin-left: auto !important;
  margin-right: 0 !important;
}

body:not(.login) .mp-log-summary .mp-summary-powered {
  margin-left: 11px !important;
}
