/* ==========================================================================
   Nova — a theme for the YOURLS admin.

   Design notes
   ------------
   Short codes are read one glyph at a time and typed by hand, so every piece of
   link data in this interface is set in a monospaced face with tabular figures.
   That is the theme's signature: the data is monospace, the chrome is not.
   Everything else stays quiet — one accent colour, hairline borders, generous
   space — so the links themselves are the loudest thing on the page.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  --nova-accent: #4f7cff;
  --nova-accent-ink: #ffffff;

  --nova-font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --nova-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --nova-radius: 12px;
  --nova-radius-sm: 8px;
  --nova-sidebar: 252px;

  --nova-shadow: 0 1px 2px rgba(8, 11, 18, 0.28), 0 8px 24px -12px rgba(8, 11, 18, 0.45);

  /* Chart ink — validated against both surfaces (see README). */
  --nova-series-1: #3987e5;
  --nova-series-2: #d95926;
  --nova-series-3: #199e70;
  --nova-good: #0ca30c;
  --nova-critical: #d03b3b;
}

/* Dark is the default surface. */
:root,
:root[data-nova-theme="dark"] {
  color-scheme: dark;
  --nova-plane: #0e1014;
  --nova-surface: #161920;
  --nova-surface-2: #1c202a;
  --nova-surface-3: #232834;
  --nova-border: rgba(255, 255, 255, 0.09);
  --nova-border-strong: rgba(255, 255, 255, 0.16);
  --nova-text: #e9ebef;
  --nova-muted: #9aa3b2;
  --nova-faint: #6c7585;
  --nova-grid: rgba(255, 255, 255, 0.07);
}

:root[data-nova-theme="light"] {
  color-scheme: light;
  --nova-plane: #f2f4f7;
  --nova-surface: #ffffff;
  --nova-surface-2: #f7f8fa;
  --nova-surface-3: #eef0f4;
  --nova-border: rgba(14, 18, 27, 0.10);
  --nova-border-strong: rgba(14, 18, 27, 0.18);
  --nova-text: #11151d;
  --nova-muted: #59616f;
  --nova-faint: #838b99;
  --nova-grid: rgba(14, 18, 27, 0.08);

  --nova-series-1: #2a78d6;
  --nova-series-2: #eb6834;
  --nova-series-3: #1baf7a;
  --nova-good: #006300;
  --nova-shadow: 0 1px 2px rgba(14, 18, 27, 0.06), 0 8px 24px -14px rgba(14, 18, 27, 0.24);
}

/* --------------------------------------------------------------------------
   2. Reset & page frame
   -------------------------------------------------------------------------- */

html {
  background: var(--nova-plane);
}

body,
body.desktop,
body.mobile {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--nova-plane) !important;
  color: var(--nova-text);
  font-family: var(--nova-font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body * {
  box-sizing: border-box;
}

a {
  color: var(--nova-accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--nova-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--nova-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3, h4 {
  color: var(--nova-text);
  font-weight: 620;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}

h2 { font-size: 20px; }
h3 { font-size: 15px; }

p { margin: 0 0 12px; }

hr {
  border: 0;
  border-top: 1px solid var(--nova-border);
  margin: 24px 0;
}

/* The core layout: a fixed rail on the left, content to the right. Anchoring
   the rail to the viewport keeps it independent of YOURLS's DOM order, which
   varies from page to page. */
#wrap {
  max-width: none;
  width: auto;
  margin: 0 0 0 var(--nova-sidebar);
  padding: 28px 32px 64px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   3. Brand & navigation rail
   -------------------------------------------------------------------------- */

body > #wrap > header[role="banner"],
header[role="banner"] {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nova-sidebar);
  height: 68px;
  margin: 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  background: var(--nova-surface);
  border-right: 1px solid var(--nova-border);
  border-bottom: 1px solid var(--nova-border);
  z-index: 40;
}

header[role="banner"] h1 {
  margin: 0;
  font-size: 0;
  line-height: 1;
}

/* Replace the YOURLS wordmark with the site's own name. The pieces of the
   original <h1> are hidden rather than removed so core markup stays untouched. */
/* Core fills this <h1> with "YOURLS: Your Own URL Shortener" as a mix of
   <span>s and bare text nodes. The spans are hidden below, but the loose text
   between them still becomes flex items — so the gap is zero here and the
   spacing is carried by a margin on the mark instead. Otherwise every stray
   text node adds another gap and pushes the site name away from the logo. */
header[role="banner"] h1 a {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 0;
  text-decoration: none;
}

header[role="banner"] h1 a span,
header[role="banner"] h1 a br,
header[role="banner"] h1 img#yourls-logo {
  display: none !important;
}

/* The mark is a full-colour SVG generated by the plugin with the live accent
   baked in, so it is a background image rather than a mask. */
header[role="banner"] h1 a::before {
  content: "";
  /* Width follows the logo's own aspect ratio, so an uploaded wordmark is not
     squashed into a square. Both are set by the plugin. */
  width: var(--nova-brand-mark-w, 24px);
  height: var(--nova-brand-mark-h, 24px);
  flex: none;
  margin-right: 10px;
  background: var(--nova-brand-mark) center / contain no-repeat;
}

header[role="banner"] h1 a::after {
  content: var(--nova-brand, "Links");
  font-family: var(--nova-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--nova-text);
}

nav[role="navigation"] {
  position: fixed;
  top: 68px;
  left: 0;
  bottom: 0;
  width: var(--nova-sidebar);
  padding: 16px 12px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--nova-surface);
  border-right: 1px solid var(--nova-border);
  z-index: 39;
}

ul#admin_menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

ul#admin_menu li {
  list-style: none;
  margin: 0;
  padding: 0;
  float: none;
  border: 0;
  background: none;
}

ul#admin_menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--nova-radius-sm);
  color: var(--nova-muted);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

ul#admin_menu li a:hover {
  background: var(--nova-surface-3);
  color: var(--nova-text);
  text-decoration: none;
}

ul#admin_menu li.nova-current > a {
  background: color-mix(in srgb, var(--nova-accent) 14%, transparent);
  color: var(--nova-accent);
  font-weight: 600;
}

/* Sub-menus (plugin pages) sit under their parent, indented by a hairline. */
ul#admin_menu ul {
  list-style: none;
  margin: 2px 0 6px;
  padding: 0 0 0 10px;
  border-left: 1px solid var(--nova-border);
  margin-left: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

ul#admin_menu ul li a {
  font-size: 13px;
  padding: 6px 10px;
  color: var(--nova-faint);
}

#admin_menu_logout_link {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--nova-border);
  order: 99;
}

#admin_menu_logout_link a {
  color: var(--nova-faint);
  font-size: 12.5px;
}

/* Menu icons, drawn from masks so they inherit the link colour. */
ul#admin_menu li.admin_menu_toplevel > a::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--nova-icon, none) center / contain no-repeat;
  mask: var(--nova-icon, none) center / contain no-repeat;
  opacity: 0.9;
}

/* --------------------------------------------------------------------------
   4. Cards, panels & shared surfaces
   -------------------------------------------------------------------------- */

.nova-card {
  background: var(--nova-surface);
  border: 1px solid var(--nova-border);
  border-radius: var(--nova-radius);
  box-shadow: var(--nova-shadow);
}

.nova-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--nova-border);
}

.nova-card-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nova-card-head .nova-sub {
  font-size: 12px;
  color: var(--nova-faint);
}

.nova-card-body {
  padding: 18px;
}

/* --------------------------------------------------------------------------
   5. The "add a link" composer
   -------------------------------------------------------------------------- */

main[role="main"] {
  display: block;
}

#new_url {
  margin: 0 0 24px;
  padding: 0;
  background: var(--nova-surface);
  border: 1px solid var(--nova-border);
  border-radius: var(--nova-radius);
  box-shadow: var(--nova-shadow);
  overflow: hidden;
  text-align: left;
}

/* Core paints every div inside #new_url pale blue. */
#new_url div {
  background: transparent;
}

#new_url > div:first-child {
  padding: 18px;
}

/* Core pins the URL field to a fixed 400px. */
#new_url_form #add-url {
  width: 100%;
}

#new_url h2 {
  display: none;
}

#new_url_form > div {
  display: grid;
  grid-template-columns: 1fr 200px auto;
  grid-template-areas:
    "urllabel keylabel ."
    "url      key      button";
  gap: 6px 12px;
  align-items: center;

  /* Core writes "<label>…</label>:" — the loose colons become anonymous grid
     items and claim their own row. Zeroing the container's font size hides
     those stray text nodes; every real child sets its own size below. */
  font-size: 0;
}

#new_url_form > div > * {
  font-size: 13.5px;
}

#new_url_form label[for="add-url"] { grid-area: urllabel; }
#new_url_form label[for="add-keyword"] { grid-area: keylabel; }
#new_url_form #add-url { grid-area: url; }
#new_url_form #add-keyword { grid-area: key; }
#new_url_form #add-button { grid-area: button; }

#new_url_form label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--nova-faint);
}

#new_url_form label strong {
  font-weight: 600;
  color: var(--nova-muted);
}

/* Form controls
   -------------------------------------------------------------------------- */

input[type="text"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--nova-surface-2);
  color: var(--nova-text);
  border: 1px solid var(--nova-border-strong);
  border-radius: var(--nova-radius-sm);
  font-family: var(--nova-font);
  font-size: 13.5px;
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

/* Anything holding a URL or a short code gets the monospace treatment. */
#add-url,
#add-keyword,
input.text[name="url"],
input[name="keyword"],
input[id^="edit-url-"],
input[id^="edit-keyword-"] {
  font-family: var(--nova-mono);
  font-size: 13px;
  letter-spacing: -0.01em;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--nova-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--nova-accent) 22%, transparent);
  background: var(--nova-surface);
}

input::placeholder {
  color: var(--nova-faint);
}

select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--nova-muted) 50%),
                    linear-gradient(135deg, var(--nova-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* Buttons
   -------------------------------------------------------------------------- */

input[type="submit"],
input[type="button"],
button,
.button:not(#main_table .button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  background: var(--nova-accent);
  color: var(--nova-accent-ink);
  border: 1px solid transparent;
  border-radius: var(--nova-radius-sm);
  font-family: var(--nova-font);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.06s ease;
}

input[type="submit"]:hover,
input[type="button"]:hover,
button:hover,
.button:not(#main_table .button):hover {
  filter: brightness(1.08);
  text-decoration: none;
}

input[type="submit"]:active,
input[type="button"]:active,
button:active {
  transform: translateY(1px);
}

.nova-btn-ghost {
  background: var(--nova-surface-2);
  color: var(--nova-text);
  border-color: var(--nova-border-strong);
}

/* Core gives the feedback strip a yellow background and a half-width margin. */
#new_url #feedback,
#feedback {
  width: auto;
  margin: 12px 0 0;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--nova-text);
}

#feedback .success,
#feedback .error {
  margin: 0;
}

/* --------------------------------------------------------------------------
   6. Notices
   -------------------------------------------------------------------------- */

.notice,
.success,
.error,
.warning {
  padding: 11px 14px;
  margin: 0 0 16px;
  border: 1px solid var(--nova-border);
  border-left: 3px solid var(--nova-muted);
  border-radius: var(--nova-radius-sm);
  background: var(--nova-surface);
  color: var(--nova-text);
  font-size: 13.5px;
}

.notice p,
.success p,
.error p {
  margin: 0;
}

.success {
  border-left-color: var(--nova-good);
}

.error {
  border-left-color: var(--nova-critical);
}

#overall_tracking {
  margin: 0 0 20px;
  color: var(--nova-muted);
  font-size: 13px;
}

#overall_tracking strong {
  font-family: var(--nova-mono);
  font-variant-numeric: tabular-nums;
  color: var(--nova-text);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   7. The link table
   -------------------------------------------------------------------------- */

table#main_table,
table.tblSorter {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--nova-surface);
  border: 1px solid var(--nova-border);
  border-radius: var(--nova-radius);
  box-shadow: var(--nova-shadow);
  overflow: hidden;
  font-size: 13.5px;
}

table#main_table thead th,
table.tblSorter thead th {
  padding: 11px 14px;
  background: var(--nova-surface-2);
  border-bottom: 1px solid var(--nova-border);
  color: var(--nova-faint);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

table#main_table thead th:hover {
  color: var(--nova-text);
}

table#main_table tbody td,
table.tblSorter tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--nova-border);
  vertical-align: middle;
  background: transparent;
}

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

table#main_table tbody tr:hover td {
  background: var(--nova-surface-2);
}

/* Short code — the signature element. Rendered as a chip so it reads as a
   token you can copy, with the domain kept quiet beside it. */
#main_table td.keyword,
.nova-code {
  font-family: var(--nova-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

#main_table td.keyword a {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--nova-surface-3);
  border: 1px solid var(--nova-border);
  color: var(--nova-text);
}

#main_table td.keyword a:hover {
  border-color: var(--nova-accent);
  color: var(--nova-accent);
  text-decoration: none;
}

#main_table td.url {
  max-width: 380px;
}

#main_table td.url a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--nova-text);
  font-weight: 500;
}

#main_table td.url small,
#main_table td.url small a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--nova-mono);
  font-size: 11.5px;
  font-weight: 400;
  color: var(--nova-faint);
}

#main_table td.timestamp,
#main_table td.ip {
  color: var(--nova-muted);
  font-size: 12.5px;
  white-space: nowrap;
}

#main_table td.ip {
  font-family: var(--nova-mono);
}

#main_table td.clicks {
  font-family: var(--nova-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}

#main_table td.actions {
  white-space: nowrap;
  text-align: right;
}

/* Row action buttons: icon-only, with the accessible name carried by the
   title attribute YOURLS already sets. */
#main_table td.actions a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0 0 0 4px;
  /* Core floats these and pushes their label off-screen with a text indent. */
  float: none;
  text-indent: 0;
  font-size: 0;
  color: var(--nova-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  vertical-align: middle;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

/* Core hides row actions entirely until the row is hovered. That makes them
   unreachable on touch and invisible to anyone scanning the page, so they stay
   present here — just recessive until the row is hovered or focused. */
body.desktop #main_table td.actions a,
body.desktop #main_table td.actions input {
  opacity: 0.5;
  pointer-events: auto;
}

body.desktop #main_table tr:hover td.actions a,
body.desktop #main_table tr:hover td.actions input,
body.desktop #main_table td.actions:focus-within a,
body.desktop #main_table tr:focus-within td.actions a {
  opacity: 1;
}

#main_table td.actions a.button:hover {
  background: var(--nova-surface-3);
  border-color: var(--nova-border);
  color: var(--nova-text);
  text-decoration: none;
}

#main_table td.actions a.button::after {
  content: "";
  width: 15px;
  height: 15px;
  background: currentColor;
  -webkit-mask: var(--nova-icon) center / contain no-repeat;
  mask: var(--nova-icon) center / contain no-repeat;
}

#main_table td.actions a.button_delete:hover {
  color: var(--nova-critical);
}

#nourl_found td {
  padding: 40px 14px !important;
  text-align: center;
  color: var(--nova-faint);
}

/* Table footer: search, filters, pagination */
#main_table tfoot th {
  padding: 14px;
  background: var(--nova-surface-2);
  border-top: 1px solid var(--nova-border);
  font-weight: 400;
}

#filter_form {
  font-size: 13px;
  color: var(--nova-muted);
}

#filter_form form > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

#filter_form input[type="text"],
#filter_form select {
  width: auto;
  min-width: 120px;
  padding: 6px 10px;
  font-size: 12.5px;
}

#filter_form input[type="submit"],
#filter_form .button {
  padding: 6px 12px;
  font-size: 12.5px;
}

#pagination,
#filter_form .navigation {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Inline edit row */
tr.edit-row td {
  background: var(--nova-surface-2) !important;
  padding: 16px 14px !important;
}

tr.edit-row input[type="text"] {
  margin-bottom: 6px;
}

/* Share box */
#shareboxes,
.share {
  background: var(--nova-surface-2);
  border: 1px solid var(--nova-border);
  border-radius: var(--nova-radius-sm);
  padding: 14px;
}

/* --------------------------------------------------------------------------
   8. Stats dashboard
   -------------------------------------------------------------------------- */

.nova-page {
  max-width: 1180px;
}

.nova-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
}

.nova-page-head h2 {
  margin: 0 0 2px;
  font-size: 22px;
}

.nova-page-head .nova-sub {
  color: var(--nova-faint);
  font-size: 13px;
}

/* Range picker — a segmented control, one row above the charts. */
.nova-ranges {
  display: inline-flex;
  padding: 3px;
  background: var(--nova-surface-2);
  border: 1px solid var(--nova-border);
  border-radius: 10px;
  gap: 2px;
}

.nova-ranges a {
  padding: 6px 11px;
  border-radius: 7px;
  color: var(--nova-muted);
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
}

.nova-ranges a:hover {
  background: var(--nova-surface-3);
  color: var(--nova-text);
  text-decoration: none;
}

.nova-ranges a[aria-current="true"] {
  background: var(--nova-accent);
  color: var(--nova-accent-ink);
}

.nova-ranges a[aria-current="true"]:hover {
  color: var(--nova-accent-ink);
}

/* Stat tiles */
.nova-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.nova-tile {
  padding: 16px 18px;
  background: var(--nova-surface);
  border: 1px solid var(--nova-border);
  border-radius: var(--nova-radius);
  box-shadow: var(--nova-shadow);
}

.nova-tile-label {
  display: block;
  margin-bottom: 6px;
  color: var(--nova-faint);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.nova-tile-value {
  display: block;
  font-size: 30px;
  font-weight: 640;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--nova-text);
}

.nova-tile-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  font-size: 12px;
  color: var(--nova-faint);
}

.nova-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.nova-delta-up { color: var(--nova-good); }
.nova-delta-down { color: var(--nova-critical); }
.nova-delta-flat { color: var(--nova-faint); }

/* Dashboard grid */
.nova-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.nova-grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

.nova-grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

/* Charts */
.nova-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.nova-chart .nova-grid-line {
  stroke: var(--nova-grid);
  stroke-width: 1;
}

.nova-chart .nova-axis-label {
  fill: var(--nova-faint);
  font-family: var(--nova-font);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.nova-chart .nova-area {
  fill: var(--nova-series-1);
  opacity: 0.14;
}

.nova-chart .nova-line {
  fill: none;
  stroke: var(--nova-series-1);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.nova-chart .nova-dot {
  fill: var(--nova-series-1);
  stroke: var(--nova-surface);
  stroke-width: 2;
}

.nova-chart .nova-hit {
  fill: transparent;
  cursor: pointer;
}

.nova-chart .nova-hit:hover + .nova-crosshair,
.nova-chart .nova-hit:focus + .nova-crosshair {
  opacity: 1;
}

.nova-chart .nova-crosshair {
  stroke: var(--nova-border-strong);
  stroke-width: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
}

/* Horizontal bar lists (countries, referrers, clients) */
.nova-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nova-bar-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  align-items: baseline;
}

.nova-bar-name {
  font-size: 13px;
  color: var(--nova-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nova-bar-value {
  font-family: var(--nova-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--nova-muted);
}

.nova-bar-track {
  grid-column: 1 / -1;
  height: 6px;
  background: var(--nova-surface-3);
  border-radius: 3px;
  overflow: hidden;
}

.nova-bar-fill {
  display: block;
  height: 100%;
  min-width: 3px;
  background: var(--nova-series-1);
  border-radius: 3px;
}

/* Hour-of-day strip */
.nova-hours {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 2px;
  align-items: end;
  height: 128px;
}

.nova-hour {
  background: var(--nova-series-1);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  opacity: 0.85;
}

.nova-hour:hover {
  opacity: 1;
}

.nova-hours-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--nova-faint);
  font-variant-numeric: tabular-nums;
}

/* Data tables inside the dashboard */
.nova-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.nova-table th {
  padding: 0 12px 9px;
  border-bottom: 1px solid var(--nova-border);
  color: var(--nova-faint);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-align: left;
  white-space: nowrap;
}

.nova-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--nova-border);
  vertical-align: middle;
}

.nova-table tr:last-child td {
  border-bottom: 0;
}

.nova-table th:first-child,
.nova-table td:first-child {
  padding-left: 0;
}

.nova-table th:last-child,
.nova-table td:last-child {
  padding-right: 0;
  text-align: right;
}

.nova-table .nova-num {
  font-family: var(--nova-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.nova-link-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.nova-link-code {
  font-family: var(--nova-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--nova-text);
}

.nova-link-target {
  font-size: 11.5px;
  color: var(--nova-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 340px;
}

.nova-spark {
  display: block;
  width: 96px;
  height: 26px;
}

.nova-spark path {
  fill: none;
  stroke: var(--nova-series-1);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.nova-spark .nova-spark-area {
  fill: var(--nova-series-1);
  stroke: none;
  opacity: 0.15;
}

/* Country / client chips */
.nova-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  background: var(--nova-surface-3);
  border-radius: 5px;
  font-size: 11.5px;
  color: var(--nova-muted);
  white-space: nowrap;
}

.nova-mono {
  font-family: var(--nova-mono);
  font-variant-numeric: tabular-nums;
}

.nova-empty {
  padding: 32px 12px;
  text-align: center;
  color: var(--nova-faint);
  font-size: 13px;
}

.nova-empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--nova-muted);
  font-size: 14px;
}

/* Screen-reader-only table view, exposed by the "Show data" toggle. */
.nova-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

details.nova-data-view {
  margin-top: 14px;
  border-top: 1px solid var(--nova-border);
  padding-top: 12px;
}

details.nova-data-view summary {
  cursor: pointer;
  color: var(--nova-faint);
  font-size: 12px;
  list-style: none;
}

details.nova-data-view summary::-webkit-details-marker {
  display: none;
}

details.nova-data-view summary::before {
  content: "▸ ";
}

details.nova-data-view[open] summary::before {
  content: "▾ ";
}

/* --------------------------------------------------------------------------
   9. Settings, plugins & tools pages
   -------------------------------------------------------------------------- */

.nova-field {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  max-width: 460px;
}

.nova-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--nova-text);
}

.nova-field .nova-help {
  font-size: 12px;
  color: var(--nova-faint);
}

.nova-field-wide {
  max-width: 100%;
}

.nova-logo-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Checkerboard so a transparent logo reads as transparent rather than white. */
.nova-logo-preview {
  display: grid;
  place-items: center;
  width: 96px;
  height: 72px;
  flex: none;
  padding: 10px;
  border: 1px solid var(--nova-border);
  border-radius: var(--nova-radius-sm);
  background-color: var(--nova-surface-2);
  background-image:
    linear-gradient(45deg, var(--nova-surface-3) 25%, transparent 25%),
    linear-gradient(-45deg, var(--nova-surface-3) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--nova-surface-3) 75%),
    linear-gradient(-45deg, transparent 75%, var(--nova-surface-3) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}

.nova-logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.nova-logo-controls {
  display: grid;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.nova-logo-controls input[type="file"] {
  width: auto;
  padding: 8px 10px;
  font-size: 12.5px;
  background: var(--nova-surface-2);
  border: 1px dashed var(--nova-border-strong);
  border-radius: var(--nova-radius-sm);
  color: var(--nova-muted);
  cursor: pointer;
}

/* The standard pseudo-element and the older WebKit alias are declared as two
   separate rules on purpose: a browser that does not recognise one selector in
   a grouped list throws the whole rule away, so grouping them would leave
   Firefox with an unstyled button. */
.nova-logo-controls input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 5px 11px;
  background: var(--nova-surface-3);
  color: var(--nova-text);
  border: 1px solid var(--nova-border-strong);
  border-radius: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nova-logo-controls input[type="file"]::-webkit-file-upload-button {
  margin-right: 10px;
  padding: 5px 11px;
  background: var(--nova-surface-3);
  color: var(--nova-text);
  border: 1px solid var(--nova-border-strong);
  border-radius: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nova-logo-controls input[type="file"]::file-selector-button:hover {
  background: var(--nova-border);
}

.nova-logo-controls input[type="file"]::-webkit-file-upload-button:hover {
  background: var(--nova-border);
}

/* Scoped to .nova-field so it beats the bold `.nova-field label` rule — this is
   a checkbox caption, not a field label. */
.nova-field label.nova-check,
.nova-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--nova-muted);
  cursor: pointer;
}

.nova-check input {
  width: auto;
  margin: 0;
  accent-color: var(--nova-accent);
}

.nova-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nova-swatch {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.nova-swatch:hover {
  transform: scale(1.08);
}

.nova-swatch[aria-pressed="true"] {
  border-color: var(--nova-text);
}

table#plugins,
#plugins {
  width: 100%;
}

#plugins tbody td {
  padding: 12px 14px;
}

#plugins .plugin_name {
  font-weight: 600;
}

/* Login screen */
body.login #wrap {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

body.login header[role="banner"],
body.login nav[role="navigation"],
body.login #footer {
  position: static;
  width: auto;
  border: 0;
  background: none;
  display: none;
}

body.login #login {
  width: 100%;
  max-width: 360px;
  padding: 28px;
  background: var(--nova-surface);
  border: 1px solid var(--nova-border);
  border-radius: 16px;
  box-shadow: var(--nova-shadow);
}

body.login #login p {
  margin-bottom: 14px;
}

body.login #login label {
  display: block;
  margin-bottom: 5px;
  font-size: 12.5px;
  font-weight: 600;
}

body.login #login input[type="submit"] {
  width: 100%;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   10. Footer
   -------------------------------------------------------------------------- */

#footer {
  margin: 0 0 0 var(--nova-sidebar);
  padding: 20px 32px 32px;
  border: 0;
  background: transparent;
  color: var(--nova-faint);
  font-size: 12px;
  text-align: left;
}

/* Core wraps the footer text in a white pill with a blue border, and puts a
   YOURLS favicon behind the link. Both have to be undone explicitly — styling
   #footer alone leaves the <p> and its <a> untouched. */
#footer p {
  max-width: none;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
}

#footer p a {
  padding-left: 0;
  background: none;
  color: var(--nova-muted);
}

#footer a {
  color: var(--nova-muted);
}

/* Theme toggle, injected into the rail */
.nova-theme-toggle {
  display: flex;
  gap: 2px;
  padding: 3px;
  margin-top: 14px;
  background: var(--nova-surface-2);
  border: 1px solid var(--nova-border);
  border-radius: 9px;
}

.nova-theme-toggle button {
  flex: 1;
  padding: 5px 0;
  background: transparent;
  color: var(--nova-faint);
  border: 0;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.nova-theme-toggle button:hover {
  background: var(--nova-surface-3);
  color: var(--nova-text);
  filter: none;
}

.nova-theme-toggle button[aria-pressed="true"] {
  background: var(--nova-surface-3);
  color: var(--nova-text);
}

/* --------------------------------------------------------------------------
   11. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  header[role="banner"] {
    position: sticky;
    top: 0;
    width: 100%;
    border-right: 0;
  }

  nav[role="navigation"] {
    position: static;
    width: 100%;
    height: auto;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--nova-border);
  }

  ul#admin_menu {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  ul#admin_menu ul {
    flex-direction: row;
    flex-wrap: wrap;
    margin-left: 0;
    padding-left: 8px;
  }

  #admin_menu_logout_link {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  #wrap,
  #footer {
    margin-left: 0;
    padding-left: 16px;
    padding-right: 16px;
  }

  #new_url_form > div {
    grid-template-columns: 1fr;
    grid-template-areas:
      "urllabel"
      "url"
      "keylabel"
      "key"
      "button";
  }

  #main_table td.url {
    max-width: 200px;
  }

  .nova-theme-toggle {
    max-width: 220px;
  }
}

@media (max-width: 640px) {
  .nova-tile-value {
    font-size: 24px;
  }

  #main_table td.timestamp,
  #main_table td.ip,
  #main_table thead th:nth-child(3),
  #main_table thead th:nth-child(4) {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   12. Leftovers from the core stylesheet

   YOURLS's own style.css loads before this file and cannot be dequeued from a
   plugin, so anything it styles that Nova does not restate keeps its 2010-era
   look — white panels, #2a85b3 borders, and YOURLS favicons behind links.
   These are the remaining pieces.
   -------------------------------------------------------------------------- */

/* Core centres all text on <body> and relies on #wrap to undo it. */
body {
  text-align: left;
}

/* Bookmarklet links on the Tools page. */
a.bookmarklet {
  padding: 8px 14px;
  background: var(--nova-surface-2);
  border: 1px solid var(--nova-border-strong);
  border-radius: var(--nova-radius-sm);
  color: var(--nova-text);
  font-size: 13px;
  font-weight: 600;
}

a.bookmarklet:hover {
  background: var(--nova-surface-3);
  background-position: 0 0;
  text-decoration: none;
}

/* Highlighted spans in the Tools / info panels. */
.sub_wrap {
  max-width: none;
}

.sub_wrap span {
  padding: 1px 5px;
  background: color-mix(in srgb, var(--nova-accent) 18%, transparent);
  border-radius: 4px;
  color: var(--nova-text);
}

/* The bar that drops in after adding or deleting a link. */
.jquery-notify-bar {
  padding: 14px 20px;
  background-color: var(--nova-surface-2);
  border-bottom: 1px solid var(--nova-border);
  color: var(--nova-text);
  font-family: var(--nova-font);
  font-size: 14px;
  text-shadow: none;
  opacity: 1;
}

.jquery-notify-bar.error,
.jquery-notify-bar.fail {
  background-color: var(--nova-surface-2);
  color: var(--nova-critical);
}

.jquery-notify-bar.success {
  background-color: var(--nova-surface-2);
  color: var(--nova-good);
}

.jquery-notify-bar span,
.jquery-notify-bar.error span,
.jquery-notify-bar.fail span,
.jquery-notify-bar.success span {
  padding-left: 0;
  background: none;
}

/* Login screen message lists carry status icons as background images. */
body.login #login ul {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

body.login #login ul li {
  padding: 8px 12px;
  margin-bottom: 6px;
  background: var(--nova-surface-2);
  border: 1px solid var(--nova-border);
  border-left: 3px solid var(--nova-muted);
  border-radius: var(--nova-radius-sm);
  font-size: 13px;
}

body.login #login ul.error li,
body.login #login ul.warning li {
  border-left-color: var(--nova-critical);
}

body.login #login ul.success li {
  border-left-color: var(--nova-good);
}

body.login #login p {
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   13. Motion & print
   -------------------------------------------------------------------------- */

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

@media print {
  header[role="banner"],
  nav[role="navigation"],
  .nova-ranges,
  #footer {
    display: none !important;
  }

  #wrap {
    margin: 0;
    padding: 0;
  }
}
